From c5ba94a2557ea524859d0e286d1a8fe451e71755 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Wed, 10 Jan 2024 20:44:14 +1100 Subject: [PATCH 1/2] refactor: use `with` keyword for import attributes --- console/unicode_width.ts | 2 +- html/_tools/generate_data.ts | 2 +- html/entities.ts | 2 +- html/entities_test.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/console/unicode_width.ts b/console/unicode_width.ts index 18e2546882ad..6fbb87682a88 100644 --- a/console/unicode_width.ts +++ b/console/unicode_width.ts @@ -1,7 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. // Ported from unicode_width rust crate, Copyright (c) 2015 The Rust Project Developers. MIT license. -import data from "./_data.json" assert { type: "json" }; +import data from "./_data.json" with { type: "json" }; import { runLengthDecode } from "./_rle.ts"; let tables: Uint8Array[] | null = null; diff --git a/html/_tools/generate_data.ts b/html/_tools/generate_data.ts index 76dd48968dab..31ddcfeb7dd1 100755 --- a/html/_tools/generate_data.ts +++ b/html/_tools/generate_data.ts @@ -3,7 +3,7 @@ // JSON version of the full canonical list of named HTML entities // https://html.spec.whatwg.org/multipage/named-characters.html -import entityList from "https://html.spec.whatwg.org/entities.json" assert { +import entityList from "https://html.spec.whatwg.org/entities.json" with { type: "json", }; diff --git a/html/entities.ts b/html/entities.ts index 04bf1ff072d7..38838d9b3226 100644 --- a/html/entities.ts +++ b/html/entities.ts @@ -66,7 +66,7 @@ const entityListRegexCache = new WeakMap(); * unescape("þð"); // "þð" * * // Using the full named entity list from the HTML spec (~47K un-minified) - * import entityList from "https://deno.land/std@$STD_VERSION/html/named_entity_list.json" assert { type: "json" }; + * import entityList from "https://deno.land/std@$STD_VERSION/html/named_entity_list.json" with { type: "json" }; * * unescape("þð", { entityList }); // "þð" * ``` diff --git a/html/entities_test.ts b/html/entities_test.ts index 16b4c3708b2b..09964db964dc 100644 --- a/html/entities_test.ts +++ b/html/entities_test.ts @@ -2,7 +2,7 @@ import { escape, unescape } from "./entities.ts"; import { assertEquals } from "../assert/mod.ts"; -import entityList from "./named_entity_list.json" assert { type: "json" }; +import entityList from "./named_entity_list.json" with { type: "json" }; Deno.test("escape()", async (t) => { await t.step('escapes &<>"', () => { From ee37e1fedf61ab915d16e6d775e31ecddc555aa4 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Wed, 10 Jan 2024 20:52:15 +1100 Subject: [PATCH 2/2] fix --- http/user_agent_test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/http/user_agent_test.ts b/http/user_agent_test.ts index 34d08313a538..0b63034bdedd 100644 --- a/http/user_agent_test.ts +++ b/http/user_agent_test.ts @@ -7,7 +7,7 @@ Deno.test({ name: "UserAgent.prototype.browser", async fn(t) { const specs = (await import("./testdata/user_agent/browser-all.json", { - assert: { type: "json" }, + with: { type: "json" }, })).default; for (const { desc, ua, expect: { major, name, version } } of specs) { await t.step({ @@ -29,7 +29,7 @@ Deno.test({ name: "UserAgent.prototype.cpu", async fn(t) { const specs = (await import("./testdata/user_agent/cpu-all.json", { - assert: { type: "json" }, + with: { type: "json" }, })).default; for (const { desc: name, ua, expect } of specs) { await t.step({ @@ -47,7 +47,7 @@ Deno.test({ name: "UserAgent.prototype.device", async fn(t) { const specs = (await import("./testdata/user_agent/device-all.json", { - assert: { type: "json" }, + with: { type: "json" }, })).default; for (const { desc: name, ua, expect: { vendor, model, type } } of specs) { await t.step({ @@ -69,7 +69,7 @@ Deno.test({ name: "UserAgent.prototype.engine", async fn(t) { const specs = (await import("./testdata/user_agent/engine-all.json", { - assert: { type: "json" }, + with: { type: "json" }, })).default; for (const { desc, ua, expect: { name, version } } of specs) { await t.step({ @@ -90,7 +90,7 @@ Deno.test({ name: "UserAgent.prototype.os", async fn(t) { const specs = (await import("./testdata/user_agent/os-all.json", { - assert: { type: "json" }, + with: { type: "json" }, })).default; for (const { desc, ua, expect: { name, version } } of specs) { await t.step({