From 7f898997994e34bff7a4f2b2f81fdc7b9a8e81bf Mon Sep 17 00:00:00 2001 From: 1024x2 Date: Fri, 26 Apr 2024 14:21:38 +0100 Subject: Fix building on Node 22 --- 0007-Build-Don-t-use-import-assertions.patch | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 0007-Build-Don-t-use-import-assertions.patch (limited to '0007-Build-Don-t-use-import-assertions.patch') diff --git a/0007-Build-Don-t-use-import-assertions.patch b/0007-Build-Don-t-use-import-assertions.patch new file mode 100644 index 0000000..6e43e48 --- /dev/null +++ b/0007-Build-Don-t-use-import-assertions.patch @@ -0,0 +1,30 @@ +From 88417678f3b38b3f2af056f2a34f9c6eb99d591f Mon Sep 17 00:00:00 2001 +From: 1024x2 <2pow11@gmail.com> +Date: Fri, 26 Apr 2024 13:56:19 +0100 +Subject: [PATCH 7/7] Build: Don't use import assertions + +Node.js 22 removed the "assert" syntax because we obviously can't keep +things working for more than 5 minutes. +We can just call readFileSync instead, which works on all currently +supported Node.js versions. +--- + scripts/build/common.mjs | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/scripts/build/common.mjs b/scripts/build/common.mjs +index 5c34ad0..ff9b854 100644 +--- a/scripts/build/common.mjs ++++ b/scripts/build/common.mjs +@@ -25,8 +25,7 @@ import { access, readdir, readFile } from "fs/promises"; + import { join, relative } from "path"; + import { promisify } from "util"; + +-// wtf is this assert syntax +-import PackageJSON from "../../package.json" assert { type: "json" }; ++const PackageJSON = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf-8")); + import { getPluginTarget } from "../utils.mjs"; + + export const VERSION = PackageJSON.version; +-- +2.44.0 + -- cgit v1.2.3