aboutsummaryrefslogtreecommitdiffstats
path: root/0007-Build-Don-t-use-import-assertions.patch
blob: 6e43e48d75220f11a34e13c08a4ec1930137bfe6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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