Skip to content

Commit

Permalink
docs: fix typos (denoland#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua authored Sep 10, 2024
1 parent 17e92e9 commit 5096423
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 19 deletions.
4 changes: 2 additions & 2 deletions _components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export default function Sidebar(
function SidebarSection(
props: { section: SidebarSection_; search: Searcher; url: string },
) {
const sluggify = (str: string) =>
const slugify = (str: string) =>
str.replaceAll(/[\s_]/g, "-")
.replaceAll(/[^a-zA-Z0-9-]/g, "")
.toLowerCase();
const slug = sluggify(props.section.title ?? "");
const slug = slugify(props.section.title ?? "");
const categoryTitle = `sidebar-category-${slug}`;
return (
<li class="mb-4">
Expand Down
2 changes: 1 addition & 1 deletion deploy/api/dynamic-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ specifier starts with `./`.

```ts
// ❌ Doesn't work because the analyzer can't statically determine if the
// specifier starts with `./` or not in thie case.
// specifier starts with `./` or not in this case.
// Compare this to the previous example. Only difference is whether to put
// `./` in the template literal or in the variable.
const rand = Math.random();
Expand Down
2 changes: 1 addition & 1 deletion deploy/kv/manual/data_modeling_typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const a: Author = {
await kv.set(["authors", a.username], a);
```

When retreiving this same object from Deno KV, however, it won't by default have
When retrieving this same object from Deno KV, however, it won't by default have
type information associated with it. If you know the shape of the object that
was stored for the key, however, you can use
[type assertion](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-assertions)
Expand Down
4 changes: 2 additions & 2 deletions deploy/kv/manual/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ parts, but not inclusive of an exact match of the key. The prefix selector may
optionally be given a `start` OR `end` key to limit the range of keys returned.
The `start` key is inclusive, and the `end` key is exclusive.

The `range` selector matches all keys that are lexographically between the given
`start` and `end` keys. The `start` key is inclusive, and the `end` key is
The `range` selector matches all keys that are lexicographically between the
given `start` and `end` keys. The `start` key is inclusive, and the `end` key is
exclusive.

> Note: In the case of the prefix selector, the `prefix` key must consist only
Expand Down
2 changes: 1 addition & 1 deletion examples/reading-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ console.log(`Read ${bytesRead} bytes`);

// You can also seek to a known location in the file and read from there.
const pos = await file.seek(6, Deno.SeekMode.Start);
console.log(`Seeked to position ${pos}`);
console.log(`Sought to position ${pos}`);
const buffer2 = new Uint8Array(2);
const bytesRead2 = await file.read(buffer2);
console.log(`Read ${bytesRead2} bytes`);
Expand Down
33 changes: 26 additions & 7 deletions reference_gen/node-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import EXCLUDE_MAP from "./node-exclude-map.json" with { type: "json" };
import { walk } from "@std/fs";
import { parse as yamlParse } from "@std/yaml";

interface Description { kind: "NOTE" | "TIP" | "IMPORTANT" | "WARNING" | "CAUTION"; description: string; }
interface Description {
kind: "NOTE" | "TIP" | "IMPORTANT" | "WARNING" | "CAUTION";
description: string;
}
function handleDescription(description: Description | string): Description {
if (typeof description === "string") {
return {
Expand All @@ -15,7 +18,10 @@ function handleDescription(description: Description | string): Description {
}
}

const descriptions: Record<string, { description?: Description; symbols?: Record<string, Description> }> = {};
const descriptions: Record<
string,
{ description?: Description; symbols?: Record<string, Description> }
> = {};
for await (const dirEntry of walk("node_descriptions", { exts: ["yaml"] })) {
const file = await Deno.readTextFile(dirEntry.path);
const parsed = yamlParse(file);
Expand All @@ -27,7 +33,11 @@ for await (const dirEntry of walk("node_descriptions", { exts: ["yaml"] })) {
}

if (parsed.symbols) {
parsed.symbols = Object.fromEntries(Object.entries(parsed.symbols).map(([key, value]) => [key, handleDescription(value)]));
parsed.symbols = Object.fromEntries(
Object.entries(parsed.symbols).map((
[key, value],
) => [key, handleDescription(value)]),
);
}

descriptions[dirEntry.name.slice(0, -5)] = parsed;
Expand Down Expand Up @@ -237,7 +247,8 @@ for (const [module, content] of Object.entries(modules)) {
}

function getNote(description: Description) {
return `> [!${description.kind}] Deno compatability\n> ` + description.description.replaceAll("\n", "\n> ") + "\n";
return `> [!${description.kind}] Deno compatibility\n> ` +
description.description.replaceAll("\n", "\n> ") + "\n";
}

for (const file of importRewriteProject.getSourceFiles()) {
Expand Down Expand Up @@ -276,10 +287,18 @@ for (const file of importRewriteProject.getSourceFiles()) {
}

for (const node of file.getDescendants()) {
if (!node.wasForgotten() && node.getName?.() && Node.isExportable(node) && Node.isJSDocable(node) && (fileDescriptions.symbols?.[node.getName()] || fileDescriptions.symbols?.["*"])) {
const description = fileDescriptions.symbols[node.getName()] || fileDescriptions.symbols["*"];
if (
!node.wasForgotten() && node.getName?.() && Node.isExportable(node) &&
Node.isJSDocable(node) &&
(fileDescriptions.symbols?.[node.getName()] ||
fileDescriptions.symbols?.["*"])
) {
const description = fileDescriptions.symbols[node.getName()] ||
fileDescriptions.symbols["*"];

const jsdoc = node.getJsDocs().find((jsdoc) => !jsdoc.getTags().some((tag) => tag.getTagName() == "module"));
const jsdoc = node.getJsDocs().find((jsdoc) =>
!jsdoc.getTags().some((tag) => tag.getTagName() == "module")
);
const note = getNote(description);

if (jsdoc) {
Expand Down
10 changes: 5 additions & 5 deletions runtime/fundamentals/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ You can control this behavior using the `nodeModulesDir` field in the

You can set this field to following values:

| Value | Behavior |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `"none"` | Don't use a local `node_modules` directory. Instead use global cache in `$DENO_DIR` that is automatically kept up to date by Deno. |
| `"auto"` | Use a local `node_modules` directory. The directory is automatically create and kept up to date by Deno. |
| `"manual"` | Use a local `node_modules` direcory. User must keep this directory up to date manually, eg. using `deno install` or `npm install`. |
| Value | Behavior |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `"none"` | Don't use a local `node_modules` directory. Instead use global cache in `$DENO_DIR` that is automatically kept up to date by Deno. |
| `"auto"` | Use a local `node_modules` directory. The directory is automatically create and kept up to date by Deno. |
| `"manual"` | Use a local `node_modules` directory. User must keep this directory up to date manually, eg. using `deno install` or `npm install`. |

It is not required to specify this setting, the following defaults are applied:

Expand Down

0 comments on commit 5096423

Please sign in to comment.