Skip to content

Commit

Permalink
Merge branch 'main' into check-example-graph
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k authored Nov 21, 2024
2 parents 79cec0e + 8c87ace commit 5f1e908
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 73 deletions.
1 change: 1 addition & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"@std/path": "jsr:@std/path@^1.0.8",
"ga4": "https://raw.githubusercontent.com/denoland/ga4/04a1ce209116f158b5ef1658b957bdb109db68ed/mod.ts",
Expand Down
77 changes: 5 additions & 72 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion reference.page.jsx
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -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);
Expand Down
23 changes: 23 additions & 0 deletions runtime/reference/cli/compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <path>` 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
Expand Down

0 comments on commit 5f1e908

Please sign in to comment.