Merge pull request #33776 from element-hq/t3chguy/merge-modules
Absorb element-modules into monorepo
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
"start": "nx start",
|
||||
"lint": "pnpm lint:types && pnpm lint:js",
|
||||
"lint:js": "eslint --max-warnings 0 src hak playwright scripts",
|
||||
"lint:js-fix": "eslint --fix --max-warnings 0 src hak playwright scripts && prettier --log-level=warn --write .",
|
||||
"lint:js-fix": "eslint --fix --max-warnings 0 src hak playwright scripts",
|
||||
"lint:types": "pnpm lint:types:src && pnpm lint:types:node && pnpm lint:types:test && pnpm lint:types:scripts && pnpm lint:types:hak",
|
||||
"lint:types:src": "tsc --noEmit",
|
||||
"lint:types:node": "tsc --noEmit -p tsconfig.node.json",
|
||||
@@ -80,7 +80,7 @@
|
||||
"@types/auto-launch": "^5.0.1",
|
||||
"@types/counterpart": "^0.18.1",
|
||||
"@types/minimist": "^1.2.1",
|
||||
"@types/node": "18.19.130",
|
||||
"@types/node": "22",
|
||||
"@types/pacote": "^11.1.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
@@ -107,7 +107,7 @@
|
||||
"prettier": "^3.0.0",
|
||||
"rimraf": "^6.0.0",
|
||||
"tar": "^7.5.8",
|
||||
"typescript": "6.0.3",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"hakDependencies": {
|
||||
|
||||
+1
-1
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user