diff --git a/package.json b/package.json index 5707b3106..23e4798cb 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,12 @@ "ruma", "nio" ], - "main": "pkg/index.js", - "types": "pkg/index.d.ts", + "exports": { + ".": { + "types": "./pkg/index.d.ts", + "default": "./pkg/index.js" + } + }, "files": [ "pkg/matrix_sdk_crypto_wasm_bg.wasm.js", "pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts", diff --git a/tests/asyncload.test.js b/tests/asyncload.test.js index df68b4eac..773d82ea2 100644 --- a/tests/asyncload.test.js +++ b/tests/asyncload.test.js @@ -1,4 +1,4 @@ -const { UserId, initAsync } = require("../pkg"); +const { UserId, initAsync } = require("@matrix-org/matrix-sdk-crypto-wasm"); test("can instantiate rust objects with async initialiser", async () => { initUserId = () => new UserId("@foo:bar.org"); diff --git a/tests/attachment.test.js b/tests/attachment.test.js index 5e9a0991f..017f9e8be 100644 --- a/tests/attachment.test.js +++ b/tests/attachment.test.js @@ -1,4 +1,4 @@ -const { Attachment, EncryptedAttachment } = require("../pkg"); +const { Attachment, EncryptedAttachment } = require("@matrix-org/matrix-sdk-crypto-wasm"); describe(Attachment.name, () => { const originalData = "hello"; diff --git a/tests/backup.test.js b/tests/backup.test.js index 631ca57ec..e2c583357 100644 --- a/tests/backup.test.js +++ b/tests/backup.test.js @@ -1,4 +1,4 @@ -const { BackupDecryptionKey } = require("../pkg"); +const { BackupDecryptionKey } = require("@matrix-org/matrix-sdk-crypto-wasm"); const aMegolmKey = { algorithm: "m.megolm.v1.aes-sha2", diff --git a/tests/dehydrated_devices.test.ts b/tests/dehydrated_devices.test.ts index c8c178702..56fda71ef 100644 --- a/tests/dehydrated_devices.test.ts +++ b/tests/dehydrated_devices.test.ts @@ -10,7 +10,7 @@ import { RoomId, TrustRequirement, UserId, -} from "../pkg/matrix_sdk_crypto_wasm"; +} from "@matrix-org/matrix-sdk-crypto-wasm"; import "fake-indexeddb/auto"; afterEach(() => { diff --git a/tests/device.test.js b/tests/device.test.js index 7dbf43eeb..00165138f 100644 --- a/tests/device.test.js +++ b/tests/device.test.js @@ -25,12 +25,12 @@ const { Qr, QrCode, QrCodeScan, -} = require("../pkg"); +} = require("@matrix-org/matrix-sdk-crypto-wasm"); const { zip, addMachineToMachine } = require("./helper"); -const { VerificationRequestPhase, QrState } = require("../pkg"); +const { VerificationRequestPhase, QrState } = require("@matrix-org/matrix-sdk-crypto-wasm"); // Uncomment to enable debug logging for tests -//const { Tracing, LoggerLevel } = require("../pkg"); +//const { Tracing, LoggerLevel } = require("@matrix-org/matrix-sdk-crypto-wasm"); //new Tracing(LoggerLevel.Trace).turnOn(); describe("LocalTrust", () => { diff --git a/tests/ecies.test.ts b/tests/ecies.test.ts index 746e1f790..ea9c5a786 100644 --- a/tests/ecies.test.ts +++ b/tests/ecies.test.ts @@ -1,4 +1,11 @@ -const { Ecies, SecretsBundle, UserId, DeviceId, OlmMachine, RequestType } = require("../pkg/matrix_sdk_crypto_wasm"); +const { + Ecies, + SecretsBundle, + UserId, + DeviceId, + OlmMachine, + RequestType, +} = require("@matrix-org/matrix-sdk-crypto-wasm"); describe(Ecies.name, () => { test("can establish a channel and decrypt the initial message", () => { diff --git a/tests/encryption.test.js b/tests/encryption.test.js index 008b3be9d..45824c3f7 100644 --- a/tests/encryption.test.js +++ b/tests/encryption.test.js @@ -4,7 +4,7 @@ const { EncryptionSettings, HistoryVisibility, VerificationState, -} = require("../pkg"); +} = require("@matrix-org/matrix-sdk-crypto-wasm"); describe("EncryptionAlgorithm", () => { test("has the correct variant values", () => { diff --git a/tests/events.test.js b/tests/events.test.js index be7fe5df8..92268c939 100644 --- a/tests/events.test.js +++ b/tests/events.test.js @@ -1,4 +1,4 @@ -const { HistoryVisibility } = require("../pkg"); +const { HistoryVisibility } = require("@matrix-org/matrix-sdk-crypto-wasm"); describe("HistoryVisibility", () => { test("has the correct variant values", () => { diff --git a/tests/helper.js b/tests/helper.js index e8126e43a..61645df3d 100644 --- a/tests/helper.js +++ b/tests/helper.js @@ -1,4 +1,4 @@ -const { DeviceLists, RequestType, KeysUploadRequest, KeysQueryRequest } = require("../pkg"); +const { DeviceLists, RequestType, KeysUploadRequest, KeysQueryRequest } = require("@matrix-org/matrix-sdk-crypto-wasm"); function* zip(...arrays) { const len = Math.min(...arrays.map((array) => array.length)); diff --git a/tests/identifiers.test.js b/tests/identifiers.test.js index d4b902712..7ebf54bd6 100644 --- a/tests/identifiers.test.js +++ b/tests/identifiers.test.js @@ -7,7 +7,7 @@ const { RoomId, ServerName, UserId, -} = require("../pkg"); +} = require("@matrix-org/matrix-sdk-crypto-wasm"); describe(UserId.name, () => { test("cannot be invalid", () => { diff --git a/tests/libolm_migration.test.ts b/tests/libolm_migration.test.ts index c0ad0b690..01c3b2973 100644 --- a/tests/libolm_migration.test.ts +++ b/tests/libolm_migration.test.ts @@ -26,7 +26,7 @@ import { StoreHandle, Tracing, UserId, -} from "../pkg"; +} from "@matrix-org/matrix-sdk-crypto-wasm"; beforeAll(() => { new Tracing(LoggerLevel.Trace).turnOn(); diff --git a/tests/machine.test.ts b/tests/machine.test.ts index 29c5af506..0c070219e 100644 --- a/tests/machine.test.ts +++ b/tests/machine.test.ts @@ -36,7 +36,7 @@ import { OtherUserIdentity, VerificationRequest, Versions, -} from "../pkg"; +} from "@matrix-org/matrix-sdk-crypto-wasm"; import "fake-indexeddb/auto"; import * as crypto from "node:crypto"; diff --git a/tests/qr_code.test.js b/tests/qr_code.test.js index 3ebc03b57..32dbca24d 100644 --- a/tests/qr_code.test.js +++ b/tests/qr_code.test.js @@ -1,4 +1,4 @@ -const { QrCodeData, QrCodeMode, Curve25519PublicKey } = require("../pkg/matrix_sdk_crypto_wasm"); +const { QrCodeData, QrCodeMode, Curve25519PublicKey } = require("@matrix-org/matrix-sdk-crypto-wasm"); describe(QrCodeData.name, () => { test("can parse the QR code bytes from the MSC", () => { diff --git a/tests/requests.test.js b/tests/requests.test.js index cbbaad8d4..dd3289af0 100644 --- a/tests/requests.test.js +++ b/tests/requests.test.js @@ -7,7 +7,7 @@ const { SignatureUploadRequest, RoomMessageRequest, KeysBackupRequest, -} = require("../pkg"); +} = require("@matrix-org/matrix-sdk-crypto-wasm"); describe("RequestType", () => { test("has the correct variant values", () => { diff --git a/tests/sync_events.test.js b/tests/sync_events.test.js index 29a4cc816..fbaccfe0c 100644 --- a/tests/sync_events.test.js +++ b/tests/sync_events.test.js @@ -1,4 +1,4 @@ -const { DeviceLists, UserId } = require("../pkg"); +const { DeviceLists, UserId } = require("@matrix-org/matrix-sdk-crypto-wasm"); describe(DeviceLists.name, () => { test("can be empty", () => { diff --git a/tests/tracing.test.js b/tests/tracing.test.js index 9ac22710d..84ad38c68 100644 --- a/tests/tracing.test.js +++ b/tests/tracing.test.js @@ -1,4 +1,4 @@ -const { Tracing, LoggerLevel, OlmMachine, UserId, DeviceId } = require("../pkg"); +const { Tracing, LoggerLevel, OlmMachine, UserId, DeviceId } = require("@matrix-org/matrix-sdk-crypto-wasm"); describe("LoggerLevel", () => { test("has the correct variant values", () => { diff --git a/tests/vodozemac_types.test.ts b/tests/vodozemac_types.test.ts index 09f4ef724..b29275d05 100644 --- a/tests/vodozemac_types.test.ts +++ b/tests/vodozemac_types.test.ts @@ -1,4 +1,4 @@ -const { Curve25519PublicKey } = require("../pkg"); +const { Curve25519PublicKey } = require("@matrix-org/matrix-sdk-crypto-wasm"); describe(Curve25519PublicKey.name, () => { test("Can create a Curve25519PublicKey from a base64 string", async () => {