From b7095d5d11ef2d2ba1fcda66e964f07025f2352d Mon Sep 17 00:00:00 2001 From: Jo Franchetti Date: Thu, 21 Nov 2024 13:40:26 +0000 Subject: [PATCH 1/2] replace encoded slash character in page titles (#1173) --- deno.json | 1 + deno.lock | 13 +++++++++++++ reference.page.jsx | 6 +++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/deno.json b/deno.json index 8a234c7ce..1ac127d0a 100644 --- a/deno.json +++ b/deno.json @@ -4,6 +4,7 @@ "@std/assert": "jsr:@std/assert@^1.0.6", "@std/dotenv": "jsr:@std/dotenv@^0.225.2", "@std/fs": "jsr:@std/fs@^0.229.3", + "@std/html": "jsr:@std/html@^1.0.3", "@std/media-types": "jsr:@std/media-types@^1.0.3", "ga4": "https://raw.githubusercontent.com/denoland/ga4/04a1ce209116f158b5ef1658b957bdb109db68ed/mod.ts", "lume/": "https://deno.land/x/lume@v2.4.1/", diff --git a/deno.lock b/deno.lock index 5fe9bbd17..cca2aaad8 100644 --- a/deno.lock +++ b/deno.lock @@ -2,6 +2,7 @@ "version": "4", "specifiers": { "jsr:@davidbonnet/astring@1.8.6": "1.8.6", + "jsr:@std/assert@^1.0.6": "1.0.8", "jsr:@std/cli@1.0.6": "1.0.6", "jsr:@std/cli@^1.0.6": "1.0.6", "jsr:@std/collections@^1.0.5": "1.0.9", @@ -18,7 +19,9 @@ "jsr:@std/fs@^1.0.4": "1.0.5", "jsr:@std/fs@~0.229.3": "0.229.3", "jsr:@std/html@1.0.3": "1.0.3", + "jsr:@std/html@^1.0.3": "1.0.3", "jsr:@std/http@1.0.9": "1.0.9", + "jsr:@std/internal@^1.0.5": "1.0.5", "jsr:@std/io@0.225": "0.225.0", "jsr:@std/json@1": "1.0.1", "jsr:@std/jsonc@1.0.1": "1.0.1", @@ -68,6 +71,12 @@ "@deno/gfm@0.8.2": { "integrity": "a7528367cbd954a2d0de316bd0097ee92f06d2cb66502c8574de133ed223424f" }, + "@std/assert@1.0.8": { + "integrity": "ebe0bd7eb488ee39686f77003992f389a06c3da1bbd8022184804852b2fa641b", + "dependencies": [ + "jsr:@std/internal" + ] + }, "@std/cli@1.0.6": { "integrity": "d22d8b38c66c666d7ad1f2a66c5b122da1704f985d3c47f01129f05abb6c5d3d" }, @@ -120,6 +129,9 @@ "jsr:@std/streams" ] }, + "@std/internal@1.0.5": { + "integrity": "54a546004f769c1ac9e025abd15a76b6671ddc9687e2313b67376125650dc7ba" + }, "@std/io@0.225.0": { "integrity": "c1db7c5e5a231629b32d64b9a53139445b2ca640d828c26bf23e1c55f8c079b3" }, @@ -1751,6 +1763,7 @@ "jsr:@std/assert@^1.0.6", "jsr:@std/dotenv@~0.225.2", "jsr:@std/fs@~0.229.3", + "jsr:@std/html@^1.0.3", "jsr:@std/media-types@^1.0.3", "npm:googleapis@144", "npm:tailwindcss@^3.4.9" diff --git a/reference.page.jsx b/reference.page.jsx index e13215e06..a81f1732d 100644 --- a/reference.page.jsx +++ b/reference.page.jsx @@ -1,4 +1,6 @@ import { walkSync } from "@std/fs/walk"; +import { unescape } from "@std/html/entities"; +import entityList from "@std/html/named-entity-list.json" with { type: "json" }; export const layout = "raw.tsx"; @@ -24,7 +26,9 @@ export default function* () { let title = ""; try { const match = titleRegexp.exec(content); - title = match[1].slice(0, -"documentation".length) + "- Deno Docs"; + const titleFirst = match[1].slice(0, -"documentation".length); + + title = unescape(titleFirst, { entityList }) + "- Deno Docs"; } catch (e) { if (!file.path.endsWith("prototype.html")) { console.error(file.path); From 8c87ace1b20626d2b552d9c4448d61f9e9e06773 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 21 Nov 2024 08:42:19 -0500 Subject: [PATCH 2/2] Compile - Add including data files or directories (#1164) --- runtime/reference/cli/compiler.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/runtime/reference/cli/compiler.md b/runtime/reference/cli/compiler.md index cb7d776d3..0119bea5f 100644 --- a/runtime/reference/cli/compiler.md +++ b/runtime/reference/cli/compiler.md @@ -84,6 +84,29 @@ To include non-statically analyzable dynamic imports, specify an deno compile --include calc.ts --include better_calc.ts main.ts ``` +## Including Data Files or Directories + +Starting in Deno 2.1, you can include files or directories in the executable by +specifying them via the `--include ` flag. + +```shell +deno compile --include names.csv --include data main.ts +``` + +Then read the file relative to the directory path of the current module via +`import.meta.dirname`: + +```ts +// main.ts +const names = Deno.readTextFileSync(import.meta.dirname + "/names.csv"); +const dataFiles = Deno.readDirSync(import.meta.dirname + "/data"); + +// use names and dataFiles here +``` + +Note this currently only works for files on the file system and not remote +files. + ## Workers Similarly to non-statically analyzable dynamic imports, code for