Skip to content

Commit ffbdf96

Browse files
authored
Merge branch 'main' into fast-middlewares
2 parents ba3a22b + 8a2b659 commit ffbdf96

186 files changed

Lines changed: 412 additions & 741 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/fresh/src/jsonify/__snapshots__/round_trip_test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ snapshot[`round trip - URL {\\n href: 'https://fresh.deno.dev/',\\n origin: 'h
4444

4545
snapshot[`round trip - 1990-05-31T00:00:00.000Z 1`] = `'[["Date","1990-05-31T00:00:00.000Z"]]'`;
4646

47+
snapshot[`round trip - Invalid Date 1`] = `'[["Date","Invalid Date"]]'`;
48+
4749
snapshot[`round trip - Map(2) { 1 => null, undefined => -2 } 1`] = `'[["Map",[1,-2,-1,2]],1,-2]'`;
4850

4951
snapshot[`round trip - Set(5) { 1, 2, null, -2, NaN } 1`] = `'[["Set",[1,2,-2,3,-3]],1,2,-2]'`;

packages/fresh/src/jsonify/round_trip_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const TESTS = [
3434
new Uint8Array([1, 2, 3]),
3535
new URL("https://fresh.deno.dev"),
3636
new Date("1990-05-31"),
37+
new Date("Invalid Date"),
3738
new Map([[1, null], [undefined, -2]]),
3839
new Set([1, 2, null, -2, NaN]),
3940
[1, , 3],

packages/fresh/src/jsonify/stringify.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,13 @@ function serializeInner(
108108
if (value instanceof URL) {
109109
str += `["URL","${value.href}"]`;
110110
} else if (value instanceof Date) {
111-
str += `["Date","${value.toISOString()}"]`;
111+
let iso: string;
112+
try {
113+
iso = value.toISOString();
114+
} catch {
115+
iso = "Invalid Date";
116+
}
117+
str += `["Date","${iso}"]`;
112118
} else if (value instanceof RegExp) {
113119
str += `["RegExp",${JSON.stringify(value.source)}, "${value.flags}"]`;
114120
} else if (value instanceof Uint8Array) {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { expect } from "@std/expect";
2+
import { satisfies, tryParseRange } from "@std/semver";
3+
import { parse } from "@std/semver/parse";
4+
import rootConfig from "../../../deno.json" with { type: "json" };
5+
import freshConfig from "../deno.json" with { type: "json" };
6+
7+
Deno.test("Fresh version consistency", () => {
8+
const freshImport: string = rootConfig.imports.fresh;
9+
const rangeStr = freshImport.split("@").pop()!;
10+
const importRange = tryParseRange(rangeStr);
11+
12+
if (importRange === undefined) {
13+
throw new Error(`Could not parse semver range from: ${freshImport}`);
14+
}
15+
16+
const packageVersion = parse(freshConfig.version);
17+
18+
expect(satisfies(packageVersion, importRange)).toBe(true);
19+
});

tools/check_docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { checkDocs } from "https://github.com/denoland/std/raw/refs/heads/main/_tools/check_docs.ts";
1+
import { checkDocs } from "./check_docs_lib.ts";
22

33
await checkDocs([
44
import.meta.resolve("../packages/fresh/src/error.ts"),

0 commit comments

Comments
 (0)