New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mtcute/wasm

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mtcute/wasm - npm Package Compare versions

Comparing version 0.7.2 to 0.8.0

9

cjs/index.d.ts

@@ -1,3 +0,4 @@

import { InitInput, MtcuteWasmModule, SyncInitInput } from './types.js';
import { MtcuteWasmModule, SyncInitInput } from './types.js';
export * from './types.js';
export declare function getWasmUrl(): URL;
/**

@@ -8,8 +9,2 @@ * Init the WASM blob synchronously (e.g. by passing a `WebAssembly.Module` instance)

/**
* Init the WASM blob asynchronously (e.g. by passing a URL to the WASM file)
*
* By default, will try to determine the best way to load the WASM file automatically.
*/
export declare function initAsync(input?: InitInput): Promise<void>;
/**
* Deflate some data with zlib headers and max output size

@@ -16,0 +11,0 @@ *

@@ -17,5 +17,14 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.__getWasm = exports.sha1 = exports.sha256 = exports.ctr256 = exports.freeCtr256 = exports.createCtr256 = exports.ige256Decrypt = exports.ige256Encrypt = exports.gunzip = exports.deflateMaxSize = exports.initAsync = exports.initSync = void 0;
const init_js_1 = require("./init.js");
exports.__getWasm = exports.sha1 = exports.sha256 = exports.ctr256 = exports.freeCtr256 = exports.createCtr256 = exports.ige256Decrypt = exports.ige256Encrypt = exports.gunzip = exports.deflateMaxSize = exports.initSync = exports.getWasmUrl = void 0;
__exportStar(require("./types.js"), exports);
function getWasmUrl() {
// would be nice if we could just use `new URL('@mtcute/wasm/mtcute.wasm', import.meta.url)`
// wherever this is used, but vite does some funky stuff with transitive dependencies
// making it not work. probably related to https://github.com/vitejs/vite/issues/8427,
// but asking the user to deoptimize the entire @mtcute/web is definitely not a good idea
// so we'll just use this hack for now
//
throw new Error('ESM-only');
}
exports.getWasmUrl = getWasmUrl;
let wasm;

@@ -48,7 +57,9 @@ let compressor;

return;
if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module);
if (!(module instanceof WebAssembly.Instance)) {
if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module);
}
module = new WebAssembly.Instance(module);
}
const instance = new WebAssembly.Instance(module);
wasm = instance.exports;
wasm = module.exports;
initCommon();

@@ -59,15 +70,2 @@ }

/**
* Init the WASM blob asynchronously (e.g. by passing a URL to the WASM file)
*
* By default, will try to determine the best way to load the WASM file automatically.
*/
async function initAsync(input) {
if (wasm !== undefined)
return;
const instance = await (0, init_js_1.loadWasmBinary)(input);
wasm = instance.exports;
initCommon();
}
exports.initAsync = initAsync;
/**
* Deflate some data with zlib headers and max output size

@@ -74,0 +72,0 @@ *

@@ -22,3 +22,2 @@ export interface MtcuteWasmModule {

}
export type SyncInitInput = BufferSource | WebAssembly.Module;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export type SyncInitInput = BufferSource | WebAssembly.Module | WebAssembly.Instance;

@@ -1,3 +0,4 @@

import { InitInput, MtcuteWasmModule, SyncInitInput } from './types.js';
import { MtcuteWasmModule, SyncInitInput } from './types.js';
export * from './types.js';
export declare function getWasmUrl(): URL;
/**

@@ -8,8 +9,2 @@ * Init the WASM blob synchronously (e.g. by passing a `WebAssembly.Module` instance)

/**
* Init the WASM blob asynchronously (e.g. by passing a URL to the WASM file)
*
* By default, will try to determine the best way to load the WASM file automatically.
*/
export declare function initAsync(input?: InitInput): Promise<void>;
/**
* Deflate some data with zlib headers and max output size

@@ -16,0 +11,0 @@ *

@@ -1,3 +0,13 @@

import { loadWasmBinary } from './init.js';
export * from './types.js';
export function getWasmUrl() {
// would be nice if we could just use `new URL('@mtcute/wasm/mtcute.wasm', import.meta.url)`
// wherever this is used, but vite does some funky stuff with transitive dependencies
// making it not work. probably related to https://github.com/vitejs/vite/issues/8427,
// but asking the user to deoptimize the entire @mtcute/web is definitely not a good idea
// so we'll just use this hack for now
// @only-if-esm
return new URL('../mtcute.wasm', import.meta.url);
// @/only-if-esm
throw new Error('ESM-only');
}
let wasm;

@@ -30,7 +40,9 @@ let compressor;

return;
if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module);
if (!(module instanceof WebAssembly.Instance)) {
if (!(module instanceof WebAssembly.Module)) {
module = new WebAssembly.Module(module);
}
module = new WebAssembly.Instance(module);
}
const instance = new WebAssembly.Instance(module);
wasm = instance.exports;
wasm = module.exports;
initCommon();

@@ -40,14 +52,2 @@ }

/**
* Init the WASM blob asynchronously (e.g. by passing a URL to the WASM file)
*
* By default, will try to determine the best way to load the WASM file automatically.
*/
export async function initAsync(input) {
if (wasm !== undefined)
return;
const instance = await loadWasmBinary(input);
wasm = instance.exports;
initCommon();
}
/**
* Deflate some data with zlib headers and max output size

@@ -54,0 +54,0 @@ *

@@ -22,3 +22,2 @@ export interface MtcuteWasmModule {

}
export type SyncInitInput = BufferSource | WebAssembly.Module;
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export type SyncInitInput = BufferSource | WebAssembly.Module | WebAssembly.Instance;
{
"name": "@mtcute/wasm",
"version": "0.7.2",
"version": "0.8.0",
"description": "WASM implementation of common algorithms used in Telegram",

@@ -9,8 +9,4 @@ "author": "Alina Sireneva <alina@tei.su>",

"type": "module",
"sideEffects": false,
"scripts": {},
"browser": {
"./esm/init.js": "./esm/init.web.js",
"./cjs/init.js": "./cjs/init.web.js"
},
"module": "esm/index.js",
"exports": {

@@ -22,3 +18,4 @@ ".": {

"./mtcute.wasm": "./mtcute.wasm"
}
},
"module": "esm/index.js"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc