Merge pull request #33776 from element-hq/t3chguy/merge-modules

Absorb element-modules into monorepo
This commit is contained in:
Michael Telatynski
2026-06-10 10:10:03 +00:00
committed by GitHub
134 changed files with 5253 additions and 237 deletions
+1 -1
View File
@@ -126,5 +126,5 @@ Element Web supports a module system that allows you to extend or modify functio
Modules are extensions that can add or modify Element Web's functionality. They are:
- Built using the [`@element-hq/element-web-module-api`](https://github.com/element-hq/element-modules/tree/main/packages/element-web-module-api)
- Built using the [`@element-hq/element-web-module-api`](https://github.com/element-hq/element-web/tree/develop/packages/module-api)
- Loaded in EW via [config.json](../../docs/config.md#modules)
+4 -7
View File
@@ -16,17 +16,14 @@ export function getSampleFilePath(file: string): string {
return join(__dirname, file);
}
export function readSampleFile(file: string, encoding: null): Promise<NonSharedBuffer>;
export function readSampleFile(file: string, encoding: null): Promise<Buffer>;
export function readSampleFile(file: string, encoding?: BufferEncoding): Promise<string>;
export function readSampleFile(
file: string,
encoding: BufferEncoding | null = "utf-8",
): Promise<NonSharedBuffer | string> {
export function readSampleFile(file: string, encoding: BufferEncoding | null = "utf-8"): Promise<Buffer | string> {
return readFile(getSampleFilePath(file), encoding);
}
export function readSampleFileSync(file: string, encoding: null): NonSharedBuffer;
export function readSampleFileSync(file: string, encoding: null): Buffer;
export function readSampleFileSync(file: string, encoding?: BufferEncoding): string;
export function readSampleFileSync(file: string, encoding: BufferEncoding | null = "utf-8"): NonSharedBuffer | string {
export function readSampleFileSync(file: string, encoding: BufferEncoding | null = "utf-8"): Buffer | string {
return readFileSync(getSampleFilePath(file), encoding);
}
+7 -7
View File
@@ -32,28 +32,28 @@ describe("Image", () => {
describe("blobIsAnimated", () => {
it("Animated GIF", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.gif"))], {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.gif")).slice()], {
type: "image/gif",
});
expect(await blobIsAnimated(img)).toBeTruthy();
});
it("Static GIF", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.gif"))], {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.gif")).slice()], {
type: "image/gif",
});
expect(await blobIsAnimated(img)).toBeFalsy();
});
it("Animated WEBP", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.webp"))], {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.webp")).slice()], {
type: "image/webp",
});
expect(await blobIsAnimated(img)).toBeTruthy();
});
it("Static WEBP", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.webp"))], {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.webp")).slice()], {
type: "image/webp",
});
expect(await blobIsAnimated(img)).toBeFalsy();
@@ -61,14 +61,14 @@ describe("Image", () => {
it("Static WEBP in extended file format", async () => {
const img = new Blob(
[fs.readFileSync(path.resolve(__dirname, "images", "static-logo-extended-file-format.webp"))],
[fs.readFileSync(path.resolve(__dirname, "images", "static-logo-extended-file-format.webp")).slice()],
{ type: "image/webp" },
);
expect(await blobIsAnimated(img)).toBeFalsy();
});
it("Animated PNG", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.apng"))]);
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "animated-logo.apng")).slice()]);
const pngBlob = img.slice(0, img.size, "image/png");
const apngBlob = img.slice(0, img.size, "image/apng");
expect(await blobIsAnimated(pngBlob)).toBeTruthy();
@@ -76,7 +76,7 @@ describe("Image", () => {
});
it("Static PNG", async () => {
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.png"))]);
const img = new Blob([fs.readFileSync(path.resolve(__dirname, "images", "static-logo.png")).slice()]);
const pngBlob = img.slice(0, img.size, "image/png");
const apngBlob = img.slice(0, img.size, "image/apng");
expect(await blobIsAnimated(pngBlob)).toBeFalsy();