Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ jobs:
- run: bun install
- run: cd web && bun run lint
- run: cd web && bun run check
- run: cd web && bun run test
- run: cd web-extension && bun run lint
67 changes: 66 additions & 1 deletion bun.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"test": "vitest",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"format": "prettier --write .",
"lint": "prettier --check . && eslint ."
Expand Down Expand Up @@ -43,7 +44,8 @@
"tailwindcss": "^4.1.8",
"typescript": "^5.8.3",
"typescript-eslint": "^8.33.1",
"vite": "^6.3.5"
"vite": "^6.3.5",
"vitest": "^3.2.4"
},
"dependencies": {
"bits-ui": "^2.4.1",
Expand Down
2 changes: 1 addition & 1 deletion web/src/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function binaryFileDummyDetails(fromFile: string, toFile: string, status:
};
}

const fileRegex = /diff --git a\/(\S+) b\/(\S+)\r?\n(?:.+\r?\n)*?(?=diff --git|$)/g;
const fileRegex = /diff --git a\/(\S+) b\/(\S+)\r?\n(?:.+\r?\n)*?(?=-- *\r?\n|diff --git|$)/g;

export function splitMultiFilePatch(patchContent: string): FileDetails[] {
const patches: FileDetails[] = [];
Expand Down
39 changes: 39 additions & 0 deletions web/src/test/patches/patch-with-signature.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From cfce089822412b142ae1e578111e650d85e64bf7 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 18 Jun 2025 18:45:34 +0000
Subject: [PATCH] Import directory diff for patch generation

---
net/minecraft/network/chat/Component.java | 2 +-
net/minecraft/server/network/ServerConnectionListener.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/minecraft/network/chat/Component.java b/net/minecraft/network/chat/Component.java
index c6e4f72..4cebf32 100644
--- a/net/minecraft/network/chat/Component.java
+++ b/net/minecraft/network/chat/Component.java
@@ -39,7 +39,7 @@ import net.minecraft.world.level.ChunkPos;

public interface Component extends Message, FormattedText, Iterable<Component> { // CraftBukkit

- // CraftBukkit start
+ // CraftBukkit start - SUPER complicated change
default java.util.stream.Stream<Component> stream() {
return com.google.common.collect.Streams.concat(java.util.stream.Stream.of(this), this.getSiblings().stream().flatMap(Component::stream));
}
diff --git a/net/minecraft/server/network/ServerConnectionListener.java b/net/minecraft/server/network/ServerConnectionListener.java
index bd07e6a..cd7a5e4 100644
--- a/net/minecraft/server/network/ServerConnectionListener.java
+++ b/net/minecraft/server/network/ServerConnectionListener.java
@@ -108,7 +108,7 @@ public class ServerConnectionListener {
LOGGER.warn("Using HAProxy, please ensure the server port is adequately firewalled.");
}
// Paper end - Warn people with console access that HAProxy is in use.
- // Paper start - Use Velocity cipher
+ // Paper start - Use Velocity cipher huge diff
ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.compress.getLoadedVariant() + " compression from Velocity.");
ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.cipher.getLoadedVariant() + " cipher from Velocity.");
// Paper end - Use Velocity cipher
--
2.49.0

36 changes: 36 additions & 0 deletions web/src/test/patches/patch-without-signature.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 3515151127e2cc0ac72f30a7c178a4ed73f31f90 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 18 Jun 2025 19:30:57 +0000
Subject: [PATCH] Import directory diff for patch generation

---
net/minecraft/network/chat/Component.java | 2 +-
net/minecraft/server/network/ServerConnectionListener.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/minecraft/network/chat/Component.java b/net/minecraft/network/chat/Component.java
index c6e4f72..4cebf32 100644
--- a/net/minecraft/network/chat/Component.java
+++ b/net/minecraft/network/chat/Component.java
@@ -39,7 +39,7 @@ import net.minecraft.world.level.ChunkPos;

public interface Component extends Message, FormattedText, Iterable<Component> { // CraftBukkit

- // CraftBukkit start
+ // CraftBukkit start - SUPER complicated change
default java.util.stream.Stream<Component> stream() {
return com.google.common.collect.Streams.concat(java.util.stream.Stream.of(this), this.getSiblings().stream().flatMap(Component::stream));
}
diff --git a/net/minecraft/server/network/ServerConnectionListener.java b/net/minecraft/server/network/ServerConnectionListener.java
index bd07e6a..cd7a5e4 100644
--- a/net/minecraft/server/network/ServerConnectionListener.java
+++ b/net/minecraft/server/network/ServerConnectionListener.java
@@ -108,7 +108,7 @@ public class ServerConnectionListener {
LOGGER.warn("Using HAProxy, please ensure the server port is adequately firewalled.");
}
// Paper end - Warn people with console access that HAProxy is in use.
- // Paper start - Use Velocity cipher
+ // Paper start - Use Velocity cipher huge diff
ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.compress.getLoadedVariant() + " compression from Velocity.");
ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.cipher.getLoadedVariant() + " cipher from Velocity.");
// Paper end - Use Velocity cipher
20 changes: 20 additions & 0 deletions web/src/test/util.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { expect, test } from "vitest";
import { splitMultiFilePatch } from "$lib/util";
import * as path from "node:path";
import * as fs from "node:fs";

test("Yield 2 patches from a patch file with signature", () => {
const patch = loadPatch("patch-with-signature.patch");
expect(splitMultiFilePatch(patch).length).toBe(2);
});

test("Yield 2 patches from a patch file without signature", () => {
const patch = loadPatch("patch-without-signature.patch");
expect(splitMultiFilePatch(patch).length).toBe(2);
});

export function loadPatch(name: string): string {
const filePath = path.resolve(__dirname, "patches", name);

return fs.readFileSync(filePath, "utf8");
}
8 changes: 7 additions & 1 deletion web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import { defineConfig } from "vitest/config";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig(() => ({
plugins: [tailwindcss(), sveltekit()],
// Tell Vitest to use the `browser` entry points in `package.json` files, even though it's running in Node
resolve: process.env.VITEST
? {
conditions: ["browser"],
}
: undefined,
}));