Skip to content

Commit 769e51c

Browse files
authored
refactor: use jsr:@std imports (#708)
1 parent fdf81c8 commit 769e51c

File tree

21 files changed

+42
-35
lines changed

21 files changed

+42
-35
lines changed

deno.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
"imports": {
2222
"@/": "./",
2323
"$fresh/": "https://raw.githubusercontent.com/denoland/fresh/60220dd33b5b0f6b5c72927c933dbc32a3c4734e/",
24+
"@std/assert": "jsr:@std/assert@^1.0.13",
25+
"@std/datetime": "jsr:@std/datetime@^0.225.5",
26+
"@std/front-matter": "jsr:@std/front-matter@^1.0.9",
27+
"@std/fs": "jsr:@std/fs@^1.0.18",
28+
"@std/http": "jsr:@std/http@^1.0.18",
29+
"@std/path": "jsr:@std/path@^1.1.0",
30+
"@std/testing": "jsr:@std/testing@^1.0.14",
31+
"@std/ulid": "jsr:@std/ulid@^1.0.0",
2432
"preact": "https://esm.sh/preact@10.19.2",
2533
"preact/": "https://esm.sh/preact@10.19.2/",
2634
"preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.2",
@@ -29,7 +37,6 @@
2937
"tailwindcss": "npm:tailwindcss@3.4.1",
3038
"tailwindcss/": "npm:/tailwindcss@3.4.1/",
3139
"tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js",
32-
"$std/": "https://deno.land/std@0.208.0/",
3340
"stripe": "npm:/stripe@13.5.0",
3441
"kv_oauth/": "https://deno.land/x/deno_kv_oauth@v0.9.1/",
3542
"tabler_icons_tsx/": "https://deno.land/x/tabler_icons_tsx@0.0.4/tsx/",

e2e_test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import {
2323
assertNotEquals,
2424
assertObjectMatch,
2525
assertStringIncludes,
26-
} from "$std/assert/mod.ts";
27-
import { isRedirectStatus, STATUS_CODE } from "$std/http/status.ts";
28-
import { resolvesNext, returnsNext, stub } from "$std/testing/mock.ts";
26+
} from "@std/assert";
27+
import { isRedirectStatus, STATUS_CODE } from "@std/http/status";
28+
import { resolvesNext, returnsNext, stub } from "@std/testing/mock";
2929
import Stripe from "stripe";
3030
import options from "./fresh.config.ts";
3131
import { _internals } from "./plugins/kv_oauth.ts";

islands/ItemsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useEffect } from "preact/hooks";
44
import { type Item } from "@/utils/db.ts";
55
import IconInfo from "tabler_icons_tsx/info-circle.tsx";
66
import { fetchValues } from "@/utils/http.ts";
7-
import { decodeTime } from "$std/ulid/mod.ts";
7+
import { decodeTime } from "@std/ulid/decode-time";
88
import { timeAgo } from "@/utils/display.ts";
99
import GitHubAvatarImg from "@/components/GitHubAvatarImg.tsx";
1010

plugins/blog/mod.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Plugin } from "$fresh/server.ts";
33
import BlogIndex from "./routes/blog/index.tsx";
44
import BlogSlug from "./routes/blog/[slug].tsx";
55
import Feed from "./routes/feed.ts";
6-
import { normalize } from "$std/url/normalize.ts";
6+
import { normalize } from "@std/path/normalize";
77

88
export function blog(): Plugin {
99
return {
@@ -19,6 +19,6 @@ export function blog(): Plugin {
1919
component: Feed,
2020
}],
2121
location: import.meta.url,
22-
projectLocation: normalize(import.meta.url + "../../../").href,
22+
projectLocation: normalize(import.meta.url + "../../../"),
2323
};
2424
}

plugins/blog/utils/posts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2023-2025 the Deno authors. All rights reserved. MIT license.
2-
import { extract } from "$std/front_matter/yaml.ts";
3-
import { join } from "$std/path/join.ts";
2+
import { extract } from "@std/front-matter/yaml";
3+
import { join } from "@std/path/join";
44

55
/**
66
* This code is based on the

plugins/blog/utils/posts_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2023-2025 the Deno authors. All rights reserved. MIT license.
22
import { getPost, getPosts } from "./posts.ts";
33

4-
import { assert, assertEquals } from "$std/assert/mod.ts";
4+
import { assert, assertEquals } from "@std/assert";
55

66
Deno.test("[blog] getPost()", async () => {
77
const post = await getPost("first-post");

plugins/error_handling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { Plugin } from "$fresh/server.ts";
33
import type { State } from "@/plugins/session.ts";
44
import { BadRequestError, redirect, UnauthorizedError } from "@/utils/http.ts";
5-
import { STATUS_CODE, STATUS_TEXT } from "$std/http/status.ts";
5+
import { STATUS_CODE, STATUS_TEXT } from "@std/http/status";
66

77
/**
88
* Returns the HTTP status code corresponding to a given runtime error. By

routes/api/stripe-webhooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2023-2025 the Deno authors. All rights reserved. MIT license.
22
import { type Handlers } from "$fresh/server.ts";
3-
import { STATUS_CODE } from "$std/http/status.ts";
3+
import { STATUS_CODE } from "@std/http/status";
44
import { isStripeEnabled, stripe } from "@/utils/stripe.ts";
55
import Stripe from "stripe";
66
import { getUserByStripeCustomer, updateUser } from "@/utils/db.ts";

routes/api/vote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2023-2025 the Deno authors. All rights reserved. MIT license.
22
import { type Handlers } from "$fresh/server.ts";
3-
import { STATUS_CODE } from "$std/http/status.ts";
3+
import { STATUS_CODE } from "@std/http/status";
44
import type { SignedInState } from "@/plugins/session.ts";
55
import { createVote } from "@/utils/db.ts";
66
import { BadRequestError } from "@/utils/http.ts";

routes/submit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
type SignedInState,
1111
State,
1212
} from "@/plugins/session.ts";
13-
import { ulid } from "$std/ulid/mod.ts";
13+
import { ulid } from "@std/ulid/ulid";
1414
import IconInfo from "tabler_icons_tsx/info-circle.tsx";
1515

1616
const SUBMIT_STYLES =

0 commit comments

Comments
 (0)