diff --git a/deno.json b/deno.json index dad683a87..fa34a4cda 100644 --- a/deno.json +++ b/deno.json @@ -19,21 +19,28 @@ }, "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" }, "imports": { - "@/": "./", "$fresh/": "https://raw.githubusercontent.com/denoland/fresh/60220dd33b5b0f6b5c72927c933dbc32a3c4734e/", - "preact": "https://esm.sh/preact@10.19.2", - "preact/": "https://esm.sh/preact@10.19.2/", - "preact-render-to-string": "https://esm.sh/*preact-render-to-string@6.2.2", + "@/": "./", + "@deno/gfm": "jsr:@deno/gfm@^0.9", "@preact/signals": "https://esm.sh/*@preact/signals@1.2.1", "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.0", - "tailwindcss": "npm:tailwindcss@3.4.1", - "tailwindcss/": "npm:/tailwindcss@3.4.1/", - "tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js", - "$std/": "https://deno.land/std@0.208.0/", - "stripe": "npm:/stripe@13.5.0", + "@std/assert": "jsr:@std/assert@^1.0", + "@std/datetime": "jsr:@std/datetime@^0.225", + "@std/front-matter": "jsr:@std/front-matter@^1.0", + "@std/fs": "jsr:@std/fs@^1.0", + "@std/http": "jsr:@std/http@^1.0", + "@std/path": "jsr:@std/path@^1.0", + "@std/testing": "jsr:@std/testing@^1.0", + "@std/ulid": "jsr:@std/ulid@^1.0", + "fresh_charts/": "https://deno.land/x/fresh_charts@0.3.1/", "kv_oauth/": "https://deno.land/x/deno_kv_oauth@v0.9.1/", + "preact": "https://esm.sh/preact@10.19.2", + "preact/": "https://esm.sh/preact@10.19.2/", + "stripe": "npm:/stripe@13.5.0", "tabler_icons_tsx/": "https://deno.land/x/tabler_icons_tsx@0.0.4/tsx/", - "fresh_charts/": "https://deno.land/x/fresh_charts@0.3.1/" + "tailwindcss": "npm:tailwindcss@3.4.1", + "tailwindcss/": "npm:/tailwindcss@3.4.1/", + "tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js" }, "exclude": ["coverage/", "_fresh/", "**/_fresh/*"], "lint": { "rules": { "tags": ["fresh", "recommended"] } } diff --git a/e2e_test.ts b/e2e_test.ts index 7ac8022f0..a6ef6fffa 100644 --- a/e2e_test.ts +++ b/e2e_test.ts @@ -15,17 +15,15 @@ import { User, } from "@/utils/db.ts"; import { stripe } from "@/utils/stripe.ts"; -import { - assert, - assertArrayIncludes, - assertEquals, - assertInstanceOf, - assertNotEquals, - assertObjectMatch, - assertStringIncludes, -} from "$std/assert/mod.ts"; -import { isRedirectStatus, STATUS_CODE } from "$std/http/status.ts"; -import { resolvesNext, returnsNext, stub } from "$std/testing/mock.ts"; +import { assert } from "@std/assert/assert"; +import { assertArrayIncludes } from "@std/assert/array-includes"; +import { assertEquals } from "@std/assert/equals"; +import { assertInstanceOf } from "@std/assert/instance-of"; +import { assertNotEquals } from "@std/assert/not-equals"; +import { assertObjectMatch } from "@std/assert/object-match"; +import { assertStringIncludes } from "@std/assert/string-includes"; +import { isRedirectStatus, STATUS_CODE } from "@std/http/status"; +import { resolvesNext, returnsNext, stub } from "@std/testing/mock"; import Stripe from "stripe"; import options from "./fresh.config.ts"; import { _internals } from "./plugins/kv_oauth.ts"; diff --git a/islands/ItemsList.tsx b/islands/ItemsList.tsx index f5e3dbca8..a1972eb5b 100644 --- a/islands/ItemsList.tsx +++ b/islands/ItemsList.tsx @@ -4,7 +4,7 @@ import { useEffect } from "preact/hooks"; import { type Item } from "@/utils/db.ts"; import IconInfo from "tabler_icons_tsx/info-circle.tsx"; import { fetchValues } from "@/utils/http.ts"; -import { decodeTime } from "$std/ulid/mod.ts"; +import { decodeTime } from "@std/ulid/decode-time"; import { timeAgo } from "@/utils/display.ts"; import GitHubAvatarImg from "@/components/GitHubAvatarImg.tsx"; diff --git a/plugins/blog/mod.ts b/plugins/blog/mod.ts index c2f27cb66..edfdebd6e 100644 --- a/plugins/blog/mod.ts +++ b/plugins/blog/mod.ts @@ -3,7 +3,7 @@ import type { Plugin } from "$fresh/server.ts"; import BlogIndex from "./routes/blog/index.tsx"; import BlogSlug from "./routes/blog/[slug].tsx"; import Feed from "./routes/feed.ts"; -import { normalize } from "$std/url/normalize.ts"; +import { normalize } from "@std/path/normalize"; export function blog(): Plugin { return { @@ -19,6 +19,6 @@ export function blog(): Plugin { component: Feed, }], location: import.meta.url, - projectLocation: normalize(import.meta.url + "../../../").href, + projectLocation: normalize(import.meta.url + "../../../"), }; } diff --git a/plugins/blog/routes/blog/[slug].tsx b/plugins/blog/routes/blog/[slug].tsx index 55c01b9cf..a9d510936 100644 --- a/plugins/blog/routes/blog/[slug].tsx +++ b/plugins/blog/routes/blog/[slug].tsx @@ -1,6 +1,6 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. import { defineRoute } from "$fresh/server.ts"; -import { CSS, render } from "https://deno.land/x/gfm@0.2.5/mod.ts"; +import { CSS, render } from "@deno/gfm"; import { getPost } from "../../utils/posts.ts"; import Head from "@/components/Head.tsx"; import Share from "../../components/Share.tsx"; diff --git a/plugins/blog/utils/posts.ts b/plugins/blog/utils/posts.ts index 002116488..349ca7461 100644 --- a/plugins/blog/utils/posts.ts +++ b/plugins/blog/utils/posts.ts @@ -1,6 +1,6 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. -import { extract } from "$std/front_matter/yaml.ts"; -import { join } from "$std/path/join.ts"; +import { extract } from "@std/front-matter/yaml"; +import { join } from "@std/path/join"; /** * This code is based on the diff --git a/plugins/blog/utils/posts_test.ts b/plugins/blog/utils/posts_test.ts index 6d207ee5e..2485c8a18 100644 --- a/plugins/blog/utils/posts_test.ts +++ b/plugins/blog/utils/posts_test.ts @@ -1,7 +1,8 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. import { getPost, getPosts } from "./posts.ts"; -import { assert, assertEquals } from "$std/assert/mod.ts"; +import { assert } from "@std/assert/assert"; +import { assertEquals } from "@std/assert/equals"; Deno.test("[blog] getPost()", async () => { const post = await getPost("first-post"); diff --git a/plugins/error_handling.ts b/plugins/error_handling.ts index 29e3cd36d..082417160 100644 --- a/plugins/error_handling.ts +++ b/plugins/error_handling.ts @@ -2,7 +2,7 @@ import type { Plugin } from "$fresh/server.ts"; import type { State } from "@/plugins/session.ts"; import { BadRequestError, redirect, UnauthorizedError } from "@/utils/http.ts"; -import { STATUS_CODE, STATUS_TEXT } from "$std/http/status.ts"; +import { STATUS_CODE, STATUS_TEXT } from "@std/http/status"; /** * Returns the HTTP status code corresponding to a given runtime error. By diff --git a/routes/api/stripe-webhooks.ts b/routes/api/stripe-webhooks.ts index e599ae42a..fb04b7618 100644 --- a/routes/api/stripe-webhooks.ts +++ b/routes/api/stripe-webhooks.ts @@ -1,6 +1,6 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. import { type Handlers } from "$fresh/server.ts"; -import { STATUS_CODE } from "$std/http/status.ts"; +import { STATUS_CODE } from "@std/http/status"; import { isStripeEnabled, stripe } from "@/utils/stripe.ts"; import Stripe from "stripe"; import { getUserByStripeCustomer, updateUser } from "@/utils/db.ts"; diff --git a/routes/api/vote.ts b/routes/api/vote.ts index 698a016f1..36d38db2c 100644 --- a/routes/api/vote.ts +++ b/routes/api/vote.ts @@ -1,6 +1,6 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. import { type Handlers } from "$fresh/server.ts"; -import { STATUS_CODE } from "$std/http/status.ts"; +import { STATUS_CODE } from "@std/http/status"; import type { SignedInState } from "@/plugins/session.ts"; import { createVote } from "@/utils/db.ts"; import { BadRequestError } from "@/utils/http.ts"; diff --git a/routes/submit.tsx b/routes/submit.tsx index 83722afd2..c1c5e6367 100644 --- a/routes/submit.tsx +++ b/routes/submit.tsx @@ -10,7 +10,7 @@ import { type SignedInState, State, } from "@/plugins/session.ts"; -import { ulid } from "$std/ulid/mod.ts"; +import { ulid } from "@std/ulid/ulid"; import IconInfo from "tabler_icons_tsx/info-circle.tsx"; const SUBMIT_STYLES = diff --git a/tasks/check_license.ts b/tasks/check_license.ts index 5eb26b023..81a83f40a 100644 --- a/tasks/check_license.ts +++ b/tasks/check_license.ts @@ -1,8 +1,8 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. // Copied from std/_tools/check_license.ts -import { walk } from "$std/fs/walk.ts"; -import { globToRegExp } from "$std/path/glob_to_regexp.ts"; +import { walk } from "@std/fs/walk"; +import { globToRegExp } from "@std/path/glob-to-regexp"; const EXTENSIONS = [".ts", ".tsx"]; const EXCLUDED_DIRS = [ diff --git a/tasks/db_seed.ts b/tasks/db_seed.ts index 95395c51c..b065e399c 100644 --- a/tasks/db_seed.ts +++ b/tasks/db_seed.ts @@ -1,7 +1,7 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. // Description: Seeds the kv db with Hacker News stories import { createItem, createUser } from "@/utils/db.ts"; -import { ulid } from "$std/ulid/mod.ts"; +import { ulid } from "@std/ulid/ulid"; // Reference: https://github.com/HackerNews/API const API_BASE_URL = `https://hacker-news.firebaseio.com/v0`; diff --git a/utils/db.ts b/utils/db.ts index 444d40c7e..22a93e57d 100644 --- a/utils/db.ts +++ b/utils/db.ts @@ -1,5 +1,5 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. -import { ulid } from "$std/ulid/mod.ts"; +import { ulid } from "@std/ulid/ulid"; const DENO_KV_PATH_KEY = "DENO_KV_PATH"; let path = undefined; @@ -59,7 +59,7 @@ export function randomItem(): Item { * @example * ```ts * import { createItem } from "@/utils/db.ts"; - * import { ulid } from "$std/ulid/mod.ts"; + * import { ulid } from "@std/ulid/ulid"; * * await createItem({ * id: ulid(), diff --git a/utils/db_test.ts b/utils/db_test.ts index 7de65ef08..0d46722db 100644 --- a/utils/db_test.ts +++ b/utils/db_test.ts @@ -1,6 +1,7 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. -import { assertEquals, assertRejects } from "$std/assert/mod.ts"; -import { ulid } from "$std/ulid/mod.ts"; +import { assertEquals } from "@std/assert/equals"; +import { assertRejects } from "@std/assert/rejects"; +import { ulid } from "@std/ulid/ulid"; import { collectValues, createItem, diff --git a/utils/display.ts b/utils/display.ts index 6139d481a..4d0507ca8 100644 --- a/utils/display.ts +++ b/utils/display.ts @@ -1,5 +1,5 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. -import { difference } from "$std/datetime/difference.ts"; +import { difference } from "@std/datetime/difference"; /** * Returns a pluralized string for the given amount and unit. @@ -22,7 +22,7 @@ export function pluralize(amount: number, unit: string) { * @example * ```ts * import { timeAgo } from "@/utils/display.ts"; - * import { SECOND, MINUTE, HOUR } from "$std/datetime/constants.ts"; + * import { SECOND, MINUTE, HOUR } from "@std/datetime/contstants"; * * timeAgo(new Date()); // Returns "just now" * timeAgo(new Date(Date.now() - 3 * HOUR)); // Returns "3 hours ago" diff --git a/utils/display_test.ts b/utils/display_test.ts index 7d7842090..025954e00 100644 --- a/utils/display_test.ts +++ b/utils/display_test.ts @@ -1,7 +1,8 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. import { formatCurrency, pluralize, timeAgo } from "./display.ts"; -import { DAY, HOUR, MINUTE, SECOND } from "$std/datetime/constants.ts"; -import { assertEquals, assertThrows } from "$std/assert/mod.ts"; +import { DAY, HOUR, MINUTE, SECOND } from "@std/datetime/constants"; +import { assertEquals } from "@std/assert/equals"; +import { assertThrows } from "@std/assert/throws"; Deno.test("[display] pluralize()", () => { assertEquals(pluralize(0, "item"), "0 items"); diff --git a/utils/github_test.ts b/utils/github_test.ts index 07784cc93..24e8a6c78 100644 --- a/utils/github_test.ts +++ b/utils/github_test.ts @@ -1,9 +1,9 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. -import { assertRejects } from "$std/assert/assert_rejects.ts"; +import { assertRejects } from "@std/assert/rejects"; import { getGitHubUser } from "./github.ts"; -import { returnsNext, stub } from "$std/testing/mock.ts"; -import { assertEquals } from "$std/assert/assert_equals.ts"; -import { STATUS_CODE } from "$std/http/status.ts"; +import { returnsNext, stub } from "@std/testing/mock"; +import { assertEquals } from "@std/assert/equals"; +import { STATUS_CODE } from "@std/http/status"; import { BadRequestError } from "@/utils/http.ts"; Deno.test("[plugins] getGitHubUser()", async (test) => { diff --git a/utils/http.ts b/utils/http.ts index 084fb5aad..1f26aedb6 100644 --- a/utils/http.ts +++ b/utils/http.ts @@ -1,5 +1,5 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. -import { RedirectStatus, STATUS_CODE } from "$std/http/status.ts"; +import { RedirectStatus, STATUS_CODE } from "@std/http/status"; /** * Returns a response that redirects the client to the given location (URL). diff --git a/utils/http_test.ts b/utils/http_test.ts index 621f64516..7bfd4f94e 100644 --- a/utils/http_test.ts +++ b/utils/http_test.ts @@ -1,8 +1,10 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. -import { returnsNext, stub } from "$std/testing/mock.ts"; +import { returnsNext, stub } from "@std/testing/mock"; import { fetchValues, getCursor, redirect } from "./http.ts"; -import { assert, assertEquals, assertRejects } from "$std/assert/mod.ts"; -import { STATUS_CODE } from "$std/http/status.ts"; +import { assert } from "@std/assert/assert"; +import { assertEquals } from "@std/assert/equals"; +import { assertRejects } from "@std/assert/rejects"; +import { STATUS_CODE } from "@std/http/status"; import { Item, randomItem } from "@/utils/db.ts"; Deno.test("[http] redirect() defaults", () => { diff --git a/utils/stripe.ts b/utils/stripe.ts index f63033eeb..10be26abd 100644 --- a/utils/stripe.ts +++ b/utils/stripe.ts @@ -1,6 +1,6 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. import Stripe from "stripe"; -import { AssertionError } from "$std/assert/assertion_error.ts"; +import { AssertionError } from "@std/assert/assertion-error"; const STRIPE_SECRET_KEY = Deno.env.get("STRIPE_SECRET_KEY"); diff --git a/utils/stripe_test.ts b/utils/stripe_test.ts index 22174b59f..0aebf3aef 100644 --- a/utils/stripe_test.ts +++ b/utils/stripe_test.ts @@ -1,5 +1,6 @@ // Copyright 2023-2024 the Deno authors. All rights reserved. MIT license. -import { AssertionError, assertThrows } from "$std/assert/mod.ts"; +import { AssertionError } from "@std/assert/assertion-error"; +import { assertThrows } from "@std/assert/throws"; import { assertIsPrice } from "./stripe.ts"; Deno.test("[stripe] assertIsPrice()", () => {