Skip to content

Commit

Permalink
fix: use with keyword for import attributes (#4141)
Browse files Browse the repository at this point in the history
* refactor: use `with` keyword for import attributes

* fix
  • Loading branch information
iuioiua authored Jan 10, 2024
1 parent 4df9f27 commit 668856c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion console/unicode_width.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion html/_tools/generate_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};

Expand Down
2 changes: 1 addition & 1 deletion html/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const entityListRegexCache = new WeakMap<EntityList, RegExp>();
* unescape("&thorn;&eth;"); // "&thorn;&eth;"
*
* // 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("&thorn;&eth;", { entityList }); // "þð"
* ```
Expand Down
2 changes: 1 addition & 1 deletion html/entities_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 &<>"', () => {
Expand Down
10 changes: 5 additions & 5 deletions http/user_agent_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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({
Expand All @@ -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({
Expand All @@ -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({
Expand All @@ -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({
Expand Down

0 comments on commit 668856c

Please sign in to comment.