diff --git a/cspell.json b/cspell.json index 0b43aab73..258e9f71e 100644 --- a/cspell.json +++ b/cspell.json @@ -37,6 +37,7 @@ "Brevik", "bunx", "Burgener", + "bybrave", "callees", "camelified", "catppuccin", diff --git a/package.json b/package.json index 6858841e9..068e4abe4 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "@babel/types": "8.0.4", "@braindb/mdast-util-wiki-link": "0.2.0", "@braindb/micromark-extension-wiki-link": "0.1.0", + "@bybrave/json5": "3.1.0", "@glimmer/syntax": "0.95.0", "@prettier/cli": "0.12.0", "@prettier/html-attributes": "0.0.3", @@ -88,7 +89,6 @@ "index-to-position": "1.2.0", "is-es5-identifier-name": "1.0.1", "jest-docblock": "30.4.0", - "json5": "2.2.3", "leven": "4.1.0", "linguist-languages": "9.4.0", "mdast-util-from-markdown": "2.0.3", diff --git a/scripts/build/packages/prettier.js b/scripts/build/packages/prettier.js index 1ff9d60b6..aa03efe6b 100644 --- a/scripts/build/packages/prettier.js +++ b/scripts/build/packages/prettier.js @@ -86,11 +86,6 @@ const mainModule = { return text; }, }, - { - module: getPackageFile("json5/dist/index.mjs"), - find: "export default lib;", - replacement: "export default { parse };", - }, { module: resolveEsmModulePath("@babel/code-frame"), process(text) { diff --git a/src/config/prettier-config/loaders.js b/src/config/prettier-config/loaders.js index 5d2862e75..a4fa4757f 100644 --- a/src/config/prettier-config/loaders.js +++ b/src/config/prettier-config/loaders.js @@ -1,5 +1,5 @@ import { pathToFileURL } from "node:url"; -import json5 from "json5"; +import { parse as parseJson5 } from "@bybrave/json5"; import parseJson from "parse-json"; import { parse as parseToml } from "smol-toml"; import readFile from "../../utilities/read-file.js"; @@ -82,7 +82,7 @@ async function loadToml(file) { async function loadJson5(file) { const content = await readFile(file); try { - return json5.parse(content); + return parseJson5(content); } catch (/** @type {any} */ error) { error.message = `JSON5 Error in ${file}:\n${error.message}`; throw error; diff --git a/yarn.lock b/yarn.lock index 68d924f06..bceb10aa1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -476,6 +476,15 @@ __metadata: languageName: node linkType: hard +"@bybrave/json5@npm:3.1.0": + version: 3.1.0 + resolution: "@bybrave/json5@npm:3.1.0" + bin: + json5: lib/cli.js + checksum: 10/167c928e5abb6993d8e2748549d878773e583c9dee911959f495872be2f32219979e4f82e26f1e3e11cdf1e6874f0e3827da7f987cde627dc142c9e1bcaa90c1 + languageName: node + linkType: hard + "@cacheable/memory@npm:^2.2.0": version: 2.2.0 resolution: "@cacheable/memory@npm:2.2.0" @@ -6524,7 +6533,7 @@ __metadata: languageName: node linkType: hard -"json5@npm:2.2.3, json5@npm:^2.2.3": +"json5@npm:^2.2.3": version: 2.2.3 resolution: "json5@npm:2.2.3" bin: @@ -8208,6 +8217,7 @@ __metadata: "@babel/types": "npm:8.0.4" "@braindb/mdast-util-wiki-link": "npm:0.2.0" "@braindb/micromark-extension-wiki-link": "npm:0.1.0" + "@bybrave/json5": "npm:3.1.0" "@eslint/js": "npm:10.0.1" "@glimmer/syntax": "npm:0.95.0" "@prettier/cli": "npm:0.12.0" @@ -8286,7 +8296,6 @@ __metadata: jest-watch-typeahead: "npm:3.0.1" jsesc: "npm:3.1.0" json-test-suite: "npm:1.0.0" - json5: "npm:2.2.3" jsx-test-suite: "npm:0.0.2" knip: "npm:6.32.0" less-test-suite: "npm:0.0.1"