Skip to content
Merged

Std #2632

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
},
"tasks": {
"dev": "LUME_LOGS=WARN deno run --env-file -A lume.ts -s",
"dev:std": "deno task generate:std-docs && LUME_LOGS=WARN deno run --env-file -A lume.ts -s",
"serve": "deno task dev",
"serve:style": "BUILD_TYPE=FULL deno task lume -s --config=_config-styleguide.ts",
"start": "deno task dev",
"build": "deno task generate:reference && BUILD_TYPE=FULL deno run --env-file -A lume.ts && tailwindcss -i styles.css -o _site/styles.css --minify",
"build": "deno task generate:reference && deno task generate:std-docs && BUILD_TYPE=FULL deno run --env-file -A lume.ts && tailwindcss -i styles.css -o _site/styles.css --minify",
"build:light": "deno run --env-file -A lume.ts",
"prod": "deno run --allow-read --allow-env --allow-net server.ts",
"test": "deno test -A",
Expand All @@ -38,6 +39,7 @@
"generate:llms": "deno run -A generate_llms_files.ts",
"generate:llms:site": "deno run -A generate_llms_files.ts _site",
"generate:reference": "cd reference_gen && deno task types && deno task doc",
"generate:std-docs": "deno run -A scripts/generate_std_docs.ts",
"cache:clear": "rm -f reference_gen/.gen-cache*.json reference_gen/.node-incremental-cache.json",
"search:upload": "deno run -A orama/upload_orama_index.ts --full",
"search:analyze": "deno run -A orama/analyze_orama_index.ts"
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and compares it against a stored reference version. Rather than manually writing
assertions for each property, you let the test runner record the entire output
structure, making it easier to detect any unexpected changes.

The [Deno Standard Library](/runtime/fundamentals/standard_library/) has a
The [Deno Standard Library](/runtime/reference/std/) has a
[snapshot module](https://jsr.io/@std/testing/doc/snapshot), which enables
developers to write tests which assert a value against a reference snapshot.
This reference snapshot is a serialized representation of the original value and
Expand Down
4 changes: 2 additions & 2 deletions examples/videos/command_line_utility.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ CLI tools.
### An introduction to Deno's Standard Library

If you want to create a command line tool you can do so with
[Deno's standard Library](https://docs.deno.com/runtime/fundamentals/standard_library/).
It contains dozens of stable libraries with helpful utility functions that can
[Deno's standard Library](https://docs.deno.com/runtime/reference/std/). It
contains dozens of stable libraries with helpful utility functions that can
cover a lot of the basics when working with JavaScript in the web. The standard
Library also works in multiple runtimes and environments like Node.js and the
browser.
Expand Down
3 changes: 2 additions & 1 deletion oldurls.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,6 @@
"/deploy/tutorials/*": "/examples/",
"/deploy/kv/tutorials/": "/examples/kv/",
"/deploy/kv/tutorials/schedule_notification/": "/examples/",
"/deploy/kv/tutorials/webhook_processor/": "/examples/"
"/deploy/kv/tutorials/webhook_processor/": "/examples/",
"/runtime/fundamentals/standard_library/": "/runtime/reference/std/"
}
56 changes: 52 additions & 4 deletions runtime/_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ export const sidebar = [
title: "Configuration",
href: "/runtime/fundamentals/configuration/",
},
{
title: "Standard library",
href: "/runtime/fundamentals/standard_library/",
},
{
title: "Web development",
href: "/runtime/fundamentals/web_dev/",
Expand Down Expand Up @@ -226,6 +222,58 @@ export const sidebar = [
},
],
},
{
title: "Standard library",
items: [
{ title: "Overview", href: "/runtime/reference/std/" },
...[
"assert",
"async",
"bytes",
"cache",
"cbor",
"cli",
"collections",
"crypto",
"csv",
"data-structures",
"datetime",
"dotenv",
"encoding",
"expect",
"fmt",
"front-matter",
"fs",
"html",
"http",
"ini",
"internal",
"io",
"json",
"jsonc",
"log",
"media-types",
"msgpack",
"net",
"path",
"random",
"regexp",
"semver",
"streams",
"tar",
"testing",
"text",
"toml",
"ulid",
"uuid",
"webgpu",
"yaml",
].map((name) => ({
title: name,
href: `/runtime/reference/std/${name}/`,
})),
],
},
{
title: "Configuring TypeScript",
href: "/runtime/reference/ts_config_migration/",
Expand Down
8 changes: 0 additions & 8 deletions runtime/fundamentals/_category_.json

This file was deleted.

3 changes: 1 addition & 2 deletions runtime/fundamentals/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ import { pascalCase } from "https://deno.land/x/case/mod.ts";

Deno recommends [JSR](https://jsr.io), the modern JavaScript registry, for third
party modules. There, you'll find plenty of well documented ES modules for your
projects, including the
[Deno Standard Library](/runtime/fundamentals/standard_library/).
projects, including the [Deno Standard Library](/runtime/reference/std/).

You can
[read more about Deno's support for npm packages here](/runtime/fundamentals/node/#using-npm-modules).
Expand Down
108 changes: 0 additions & 108 deletions runtime/fundamentals/standard_library.md

This file was deleted.

9 changes: 4 additions & 5 deletions runtime/fundamentals/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,9 @@ deno test --junit-path=./report.xml

## Spying, mocking (test doubles), stubbing and faking time

The [Deno Standard Library](/runtime/fundamentals/standard_library/) provides a
set of functions to help you write tests that involve spying, mocking, and
stubbing. Check out the
[@std/testing documentation on JSR](https://jsr.io/@std/testing) for more
The [Deno Standard Library](/runtime/reference/std/) provides a set of functions
to help you write tests that involve spying, mocking, and stubbing. Check out
the [@std/testing documentation on JSR](https://jsr.io/@std/testing) for more
information on each of these utilities or our
[tutorial on mocking and spying in tests with deno](/examples/mocking_tutorial/).

Expand Down Expand Up @@ -679,7 +678,7 @@ Deno.test({

## Snapshot testing

The [Deno Standard Library](/runtime/fundamentals/standard_library/) includes a
The [Deno Standard Library](/runtime/reference/std/) includes a
[snapshot module](https://jsr.io/@std/testing/doc/snapshot/~) that allows
developers to write tests by comparing values against reference snapshots. These
snapshots are serialized representations of the original values and are stored
Expand Down
5 changes: 2 additions & 3 deletions runtime/fundamentals/web_dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ applications, making your web dev a delightful experience.
2. Deno has [built-in TypeScript support](/runtime/fundamentals/typescript/),
allowing you to write TypeScript code without additional configuration or
tooling.
3. Deno comes with a [standard library](/runtime/fundamentals/standard_library/)
that includes modules for common tasks like HTTP servers, file system
operations, and more.
3. Deno comes with a [standard library](/runtime/reference/std/) that includes
modules for common tasks like HTTP servers, file system operations, and more.

For your vanilla TypeScript, or JavaScript, web applications, you can use the
built-in Deno [HTTP server](/runtime/fundamentals/http_server/). This is a great
Expand Down
5 changes: 2 additions & 3 deletions runtime/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ experience. It's built on [V8](https://v8.dev/),
runtimes give full access every script they run, Deno allows you to enforce
granular permissions.
- Deno has a **robust built-in toolchain.** Unlike Node or browser JavaScript,
Deno includes a [standard library](/runtime/fundamentals/standard_library/),
along with a first-party
[linter/formatter](/runtime/fundamentals/linting_and_formatting/),
Deno includes a [standard library](/runtime/reference/std/), along with a
first-party [linter/formatter](/runtime/fundamentals/linting_and_formatting/),
[test runner](/runtime/fundamentals/testing/), and more.
- Deno is **fully compatible with [Node and npm](/runtime/fundamentals/node/).**
- Deno is **fast and reliable**.
Expand Down
85 changes: 85 additions & 0 deletions runtime/reference/std/_overrides/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# @std Package Overrides & Custom Blocks

This directory holds editorial _override_ markdown files that are appended to
the autogenerated Standard Library package pages.

## How generation works

1. The script `scripts/generate_std_docs.ts` fetches overview HTML for every
`@std/*` package from JSR.
2. It writes (or rewrites) `runtime/reference/std/<package>.md` with:
- Frontmatter (title, description, version, stability)
- An (optional) stability banner
- The package overview (HTML fragment)
- `## Additional Examples` section containing the override markdown if a file
named `_overrides/<package>.md` exists.
- A preserved custom block (see below).

## Adding override content

Create a file named after the package, e.g.:

```text
_overrides/internal.md
```

Put any extra examples, guides, etc. in that file. On the next generation run it
will appear under an "Additional Examples" heading.

Important:

- Do not include frontmatter (`--- ... ---`) in override files. They are
appended verbatim into the generated page body; frontmatter will show up as
plain text.
- Keep overrides to content sections (headings, paragraphs, code blocks,
images).
- If you need to change title/description/stability, edit the generated page's
frontmatter or adjust upstream JSR package metadata, not here.

Minimal example for `_overrides/internal.md`:

### Using diff utilities

```ts
import { diffStr } from "jsr:@std/internal";
console.log(diffStr("a", "b"));
```

## Persistent custom edits inside the generated page

If you need to add content _directly_ inside a generated page and keep it across
regenerations, use the custom block markers the generator recognizes:

```markdown
<!-- custom:start -->

Your custom content here (additional sections, notes, etc.)

<!-- custom:end -->
```

Anything between those markers is preserved every time the generator runs. If a
page has no custom block yet, a commented placeholder will be added for
convenience.

## Safety notes

- Do not edit outside the custom block; those areas will be replaced.
- If you rename or remove the markers, the content will be lost on the next run.
- Overrides (`_overrides/<pkg>.md`) are never modified by the generator; they
are simply read and injected.

## Regenerating

Run:

```sh
deno task generate:std-docs
```

This will rebuild all pages and keep both overrides and custom block content.

## Skipping generation for a page (future option)

Currently every page is regenerated. If we later want a skip/manual mode, we can
add a frontmatter flag (e.g. `generated: false`).
16 changes: 16 additions & 0 deletions runtime/reference/std/_overrides/internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "@std/internal"
description: "The internal package for @std. Do not use this directly."
jsr: jsr:@std/internal
pkg: internal
version: 1.0.12
generated: true
stability: internal
---

:::info Internal

This @std package is for internal use and not intended for public consumption.
APIs may change or be removed.

:::
Loading