Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cld3-asm

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cld3-asm - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

dist/cjs/lib/browser/cld3.js

21

CHANGELOG.md

@@ -0,1 +1,22 @@

<a name="3.0.0"></a>
# [3.0.0](https://github.com/kwonoj/cld3-asm/compare/v2.0.1...v3.0.0) (2019-06-13)
### build
* **tsconfig:** update target ([f619336](https://github.com/kwonoj/cld3-asm/commit/f619336))
### Features
* **loadmodule:** no longer accepts environment ([4a6ecdc](https://github.com/kwonoj/cld3-asm/commit/4a6ecdc))
### BREAKING CHANGES
* **tsconfig:** runtime requires es2018
* **loadmodule:** do not support environment override
<a name="2.0.1"></a>

@@ -2,0 +23,0 @@ ## [2.0.1](https://github.com/kwonoj/cld3-asm/compare/v2.0.0...v2.0.1) (2019-06-10)

94

dist/cjs/cldLoader.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = require("./util/logger");
var wrapCldInterface_1 = require("./wrapCldInterface");
const logger_1 = require("./util/logger");
const wrapCldInterface_1 = require("./wrapCldInterface");
// size of pointer to calculate pointer position.
var PTR_SIZE = 4;
const PTR_SIZE = 4;
/**

@@ -16,5 +16,5 @@ * @internal

*/
exports.cldLoader = function (asmModule, _environment) {
var cwrap = asmModule.cwrap, _free = asmModule._free, allocateUTF8 = asmModule.allocateUTF8, _malloc = asmModule._malloc, getValue = asmModule.getValue, Pointer_stringify = asmModule.Pointer_stringify, setValue = asmModule.setValue;
var cldInterface = wrapCldInterface_1.wrapCldInterface(cwrap);
exports.cldLoader = (asmModule) => {
const { cwrap, _free, allocateUTF8, _malloc, getValue, UTF8ToString, setValue } = asmModule;
const cldInterface = wrapCldInterface_1.wrapCldInterface(cwrap);
/**

@@ -24,30 +24,26 @@ * Naive auto-dispose interface to call cld interface with string params.

*/
var usingParamPtr = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var params = args.slice();
var fn = params.pop();
var paramsPtr = params.map(function (param) { return allocateUTF8(param); });
var ret = fn.apply(void 0, paramsPtr);
paramsPtr.forEach(function (paramPtr) { return _free(paramPtr); });
const usingParamPtr = (...args) => {
const params = [...args];
const fn = params.pop();
const paramsPtr = params.map((param) => allocateUTF8(param));
const ret = fn(...paramsPtr);
paramsPtr.forEach(paramPtr => _free(paramPtr));
return ret;
};
// grab constant values from cld3 library
var unknownIdentifier = Pointer_stringify(cldInterface.getUnknownIdentifier());
var minBytesDefault = cldInterface.getMinNumBytesDefault();
var maxBytesDefault = cldInterface.getMaxNumBytesDefault();
var maxBytesInput = cldInterface.getMaxNumBytesInput();
var languageResultStructSize = cldInterface.sizeLanguageResult();
logger_1.log("cldLoader: cld3 wasm initialized with default values", {
unknownIdentifier: unknownIdentifier,
minBytesDefault: minBytesDefault,
maxBytesDefault: maxBytesDefault,
maxBytesInput: maxBytesInput,
languageResultStructSize: languageResultStructSize
const unknownIdentifier = UTF8ToString(cldInterface.getUnknownIdentifier());
const minBytesDefault = cldInterface.getMinNumBytesDefault();
const maxBytesDefault = cldInterface.getMaxNumBytesDefault();
const maxBytesInput = cldInterface.getMaxNumBytesInput();
const languageResultStructSize = cldInterface.sizeLanguageResult();
logger_1.log(`cldLoader: cld3 wasm initialized with default values`, {
unknownIdentifier,
minBytesDefault,
maxBytesDefault,
maxBytesInput,
languageResultStructSize
});
// both identifier should match all time, check when initialize binary
if (unknownIdentifier !== "und" /* UNKNOWN */) {
throw new Error("cld3 binary unknownIdentifier constant does not match to LanguageCode enum");
throw new Error(`cld3 binary unknownIdentifier constant does not match to LanguageCode enum`);
}

@@ -60,8 +56,8 @@ /**

*/
var volatileReadResultStruct = function (structPtr) {
const volatileReadResultStruct = (structPtr) => {
// get value of first field of LanguageResult struct (char*)
var languageStringPtr = getValue(structPtr + PTR_SIZE * 0, '*');
const languageStringPtr = getValue(structPtr + PTR_SIZE * 0, '*');
// be careful to match order of properties to match pointer to struct field.
var ret = {
language: Pointer_stringify(languageStringPtr),
const ret = {
language: UTF8ToString(languageStringPtr),
probability: getValue(structPtr + PTR_SIZE * 1, 'float'),

@@ -78,21 +74,19 @@ is_reliable: !!getValue(structPtr + PTR_SIZE * 2, 'i8'),

return {
create: function (minBytes, maxBytes) {
if (minBytes === void 0) { minBytes = minBytesDefault; }
if (maxBytes === void 0) { maxBytes = maxBytesDefault; }
var cldPtr = cldInterface.create(minBytes, maxBytes);
create: (minBytes = minBytesDefault, maxBytes = maxBytesDefault) => {
const cldPtr = cldInterface.create(minBytes, maxBytes);
return {
findLanguage: function (text) {
findLanguage: (text) => {
// `findLanguage` requires caller must allocate memory for return value.
var resultPtr = _malloc(languageResultStructSize);
usingParamPtr(text, function (textPtr) { return cldInterface.findLanguage(cldPtr, textPtr, resultPtr); });
const resultPtr = _malloc(languageResultStructSize);
usingParamPtr(text, textPtr => cldInterface.findLanguage(cldPtr, textPtr, resultPtr));
return volatileReadResultStruct(resultPtr);
},
findMostFrequentLanguages: function (text, numLangs) {
findMostFrequentLanguages: (text, numLangs) => {
// `findMostFrequentLanguages` requires caller must allocate memory for return value.
var languageListPtr = _malloc(numLangs * PTR_SIZE);
const languageListPtr = _malloc(numLangs * PTR_SIZE);
// For convinience, we'll store allocated pointer to each empty LanguageResult for return value
var resultStructsPtr = [];
const resultStructsPtr = [];
//allocate memory in js. `findTopNMostFreqLangs` always returns vector with given num_langs, allows predictable memory allocation.
for (var idx = 0; idx < numLangs; idx++) {
var resultPtr = _malloc(languageResultStructSize);
for (let idx = 0; idx < numLangs; idx++) {
const resultPtr = _malloc(languageResultStructSize);
resultStructsPtr.push(resultPtr);

@@ -102,9 +96,7 @@ // fill in array with allocated struct ptr

}
var languageCount = usingParamPtr(text, function (textPtr) {
return cldInterface.findTopNMostFreqLangs(cldPtr, textPtr, numLangs, languageListPtr);
});
const languageCount = usingParamPtr(text, textPtr => cldInterface.findTopNMostFreqLangs(cldPtr, textPtr, numLangs, languageListPtr));
// if `numLangs` exceeds number of languages detected rest of array will be filled with default result with unknown language identifier
var ret = resultStructsPtr
.map(function (ptr) { return volatileReadResultStruct(ptr); })
.filter(function (x) { return x.language !== unknownIdentifier; });
const ret = resultStructsPtr
.map(ptr => volatileReadResultStruct(ptr))
.filter(x => x.language !== unknownIdentifier);
// each LanguageResult struct is freed via `volatileReadResultStruct` already. delete allocated memory for array itself.

@@ -114,3 +106,3 @@ _free(languageListPtr);

},
dispose: function () { return cldInterface.destroy(cldPtr); }
dispose: () => cldInterface.destroy(cldPtr)
};

@@ -117,0 +109,0 @@ }

@@ -10,4 +10,2 @@ "use strict";

exports.LanguageCode = languageCode_1.LanguageCode;
var emscripten_wasm_loader_1 = require("emscripten-wasm-loader");
exports.ENVIRONMENT = emscripten_wasm_loader_1.ENVIRONMENT;
//# sourceMappingURL=index.js.map
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var emscripten_wasm_loader_1 = require("emscripten-wasm-loader");
var cldLoader_1 = require("./cldLoader");
var logger_1 = require("./util/logger");
const emscripten_wasm_loader_1 = require("emscripten-wasm-loader");
const cldLoader_1 = require("./cldLoader");
const logger_1 = require("./util/logger");
//imports MODULARIZED emscripten preamble
const runtime = require("./lib/node/cld3");
/**

@@ -48,3 +14,2 @@ * Load, initialize wasm binary to use actual cld wasm instances.

* @param {string | object} [InitOptions.locateBinary] - custom resolution logic for wasm binary. (not supported)
* @param {ENVIRONMENT} [InitOptions.environment] For overriding running environment
* It could be either remote endpoint url, or loader-returned object for bundler. Check examples/browser_* for references.

@@ -54,23 +19,9 @@ *

*/
var loadModule = function (initOptions) {
if (initOptions === void 0) { initOptions = {}; }
return __awaiter(_this, void 0, void 0, function () {
var runtime, environment, timeout, env, overriddenModule, moduleLoader;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
runtime = require("./lib/cld3");
environment = initOptions.environment, timeout = initOptions.timeout;
env = environment ? environment : emscripten_wasm_loader_1.isNode() ? emscripten_wasm_loader_1.ENVIRONMENT.NODE : emscripten_wasm_loader_1.ENVIRONMENT.WEB;
logger_1.log("loadModule: loading cld3 wasm binary", { initOptions: initOptions });
overriddenModule = { ENVIRONMENT: env };
return [4 /*yield*/, emscripten_wasm_loader_1.getModuleLoader(function (runtime) { return cldLoader_1.cldLoader(runtime, env); }, runtime, overriddenModule, { timeout: timeout })];
case 1:
moduleLoader = _a.sent();
return [2 /*return*/, moduleLoader()];
}
});
});
const loadModule = async (initOptions = {}) => {
const { timeout } = initOptions;
logger_1.log(`loadModule: loading cld3 wasm binary`, { initOptions });
const moduleLoader = await emscripten_wasm_loader_1.getModuleLoader((runtime) => cldLoader_1.cldLoader(runtime), runtime, undefined, { timeout });
return moduleLoader();
};
exports.loadModule = loadModule;
//# sourceMappingURL=loadModule.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var emscripten_wasm_loader_1 = require("emscripten-wasm-loader");
const emscripten_wasm_loader_1 = require("emscripten-wasm-loader");
/**
* Default log instance falls back to noop if not specified.
*/
var logInstance = function () {
let logInstance = () => {
/* noop */
};
var log = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return logInstance.apply(void 0, args);
};
const log = (...args) => logInstance(...args);
exports.log = log;

@@ -22,14 +16,10 @@ /**

*/
var enableLogger = function (logger) {
var scopedLogger = function (scope) { return function (message) {
var optionalParams = [];
for (var _i = 1; _i < arguments.length; _i++) {
optionalParams[_i - 1] = arguments[_i];
}
logger.apply(void 0, [scope + "::" + message].concat(optionalParams));
}; };
logInstance = scopedLogger("cld3");
emscripten_wasm_loader_1.enableLogger(scopedLogger("cld3Loader"));
const enableLogger = (logger) => {
const scopedLogger = (scope) => (message, ...optionalParams) => {
logger(`${scope}::${message}`, ...optionalParams);
};
logInstance = scopedLogger(`cld3`);
emscripten_wasm_loader_1.enableLogger(scopedLogger(`cld3Loader`));
};
exports.enableLogger = enableLogger;
//# sourceMappingURL=logger.js.map

@@ -8,3 +8,3 @@ "use strict";

*/
exports.wrapCldInterface = function (cwrap) { return ({
exports.wrapCldInterface = (cwrap) => ({
/**

@@ -60,3 +60,3 @@ * get size of struct for interop.

findTopNMostFreqLangs: cwrap('Cld_findTopNMostFreqLangs', 'number', ['number', 'number', 'number', 'number'])
}); };
});
//# sourceMappingURL=wrapCldInterface.js.map

@@ -14,4 +14,4 @@ import { log } from './util/logger';

*/
export const cldLoader = (asmModule, _environment) => {
const { cwrap, _free, allocateUTF8, _malloc, getValue, Pointer_stringify, setValue } = asmModule;
export const cldLoader = (asmModule) => {
const { cwrap, _free, allocateUTF8, _malloc, getValue, UTF8ToString, setValue } = asmModule;
const cldInterface = wrapCldInterface(cwrap);

@@ -31,3 +31,3 @@ /**

// grab constant values from cld3 library
const unknownIdentifier = Pointer_stringify(cldInterface.getUnknownIdentifier());
const unknownIdentifier = UTF8ToString(cldInterface.getUnknownIdentifier());
const minBytesDefault = cldInterface.getMinNumBytesDefault();

@@ -59,3 +59,3 @@ const maxBytesDefault = cldInterface.getMaxNumBytesDefault();

const ret = {
language: Pointer_stringify(languageStringPtr),
language: UTF8ToString(languageStringPtr),
probability: getValue(structPtr + PTR_SIZE * 1, 'float'),

@@ -62,0 +62,0 @@ is_reliable: !!getValue(structPtr + PTR_SIZE * 2, 'i8'),

export { loadModule } from './loadModule';
export { log, enableLogger } from './util/logger';
export { LanguageCode } from './languageCode';
export { ENVIRONMENT } from 'emscripten-wasm-loader';
//# sourceMappingURL=index.js.map

@@ -1,4 +0,6 @@

import { ENVIRONMENT, getModuleLoader, isNode } from 'emscripten-wasm-loader';
import { getModuleLoader } from 'emscripten-wasm-loader';
import { cldLoader } from './cldLoader';
import { log } from './util/logger';
//imports MODULARIZED emscripten preamble
import * as runtime from './lib/node/cld3';
/**

@@ -10,3 +12,2 @@ * Load, initialize wasm binary to use actual cld wasm instances.

* @param {string | object} [InitOptions.locateBinary] - custom resolution logic for wasm binary. (not supported)
* @param {ENVIRONMENT} [InitOptions.environment] For overriding running environment
* It could be either remote endpoint url, or loader-returned object for bundler. Check examples/browser_* for references.

@@ -17,13 +18,5 @@ *

const loadModule = async (initOptions = {}) => {
//imports MODULARIZED emscripten preamble
//tslint:disable-next-line:no-require-imports no-var-requires
const runtime = require(`./lib/cld3`);
const { environment, timeout } = initOptions;
const env = environment ? environment : isNode() ? ENVIRONMENT.NODE : ENVIRONMENT.WEB;
const { timeout } = initOptions;
log(`loadModule: loading cld3 wasm binary`, { initOptions });
//https://github.com/kwonoj/docker-hunspell-wasm/issues/63
//Build module object to construct wasm binary module via emscripten preamble.
//apply overridden environment values to custom patched hunspell preamble.
const overriddenModule = { ENVIRONMENT: env };
const moduleLoader = await getModuleLoader((runtime) => cldLoader(runtime, env), runtime, overriddenModule, { timeout });
const moduleLoader = await getModuleLoader((runtime) => cldLoader(runtime), runtime, undefined, { timeout });
return moduleLoader();

@@ -30,0 +23,0 @@ };

@@ -1,2 +0,1 @@

import { ENVIRONMENT } from 'emscripten-wasm-loader';
import { CldAsmModule } from './cldAsmModule';

@@ -13,3 +12,3 @@ import { CldFactory } from './cldFactory';

*/
export declare const cldLoader: (asmModule: CldAsmModule, _environment?: ENVIRONMENT | undefined) => CldFactory;
export declare const cldLoader: (asmModule: CldAsmModule) => CldFactory;
//# sourceMappingURL=cldLoader.d.ts.map

@@ -6,3 +6,2 @@ export { loadModule } from './loadModule';

export { LanguageCode } from './languageCode';
export { ENVIRONMENT } from 'emscripten-wasm-loader';
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,1 @@

import { ENVIRONMENT } from 'emscripten-wasm-loader';
import { CldFactory } from './cldFactory';

@@ -9,3 +8,2 @@ /**

* @param {string | object} [InitOptions.locateBinary] - custom resolution logic for wasm binary. (not supported)
* @param {ENVIRONMENT} [InitOptions.environment] For overriding running environment
* It could be either remote endpoint url, or loader-returned object for bundler. Check examples/browser_* for references.

@@ -17,5 +15,4 @@ *

timeout: number;
environment?: ENVIRONMENT | undefined;
}>) => Promise<CldFactory>;
export { loadModule };
//# sourceMappingURL=loadModule.d.ts.map
{
"name": "cld3-asm",
"version": "2.0.1",
"version": "3.0.0",
"description": "WebAssembly based Javascript bindings for google compact language detector 3",

@@ -8,5 +8,8 @@ "main": "./dist/cjs/index.js",

"types": "./dist/types/index.d.ts",
"browser": {
"./dist/cjs/lib/node/cld3.js": "./dist/cjs/lib/browser/cld3.js",
"./dist/esm/lib/node/cld3.js": "./dist/esm/lib/browser/cld3.js"
},
"engines": {
"npm": ">=3.0.0",
"node": ">=8.0.0"
"node": ">=10"
},

@@ -17,3 +20,3 @@ "config": {

},
"cld3-version": "c536440-190202"
"cld3-version": "ade8819-190613"
},

@@ -61,5 +64,5 @@ "lint-staged": {

"@types/chai": "^4.1.7",
"@types/jest": "^24.0.13",
"@types/jest": "^24.0.14",
"@types/lodash": "^4.14.134",
"@types/node": "^12.0.7",
"@types/node": "^12.0.8",
"@types/shelljs": "^0.8.5",

@@ -71,3 +74,3 @@ "@types/utf8": "^2.1.6",

"cz-conventional-changelog": "2.1.0",
"husky": "^2.4.0",
"husky": "^2.4.1",
"jest": "^24.8.0",

@@ -89,3 +92,3 @@ "jest-spin-reporter": "^1.0.2",

"dependencies": {
"emscripten-wasm-loader": "^2.2.3"
"emscripten-wasm-loader": "^3.0.2"
},

@@ -92,0 +95,0 @@ "husky": {

@@ -32,6 +32,6 @@ [![Build Status](https://travis-ci.org/kwonoj/cld3-asm.svg?branch=master)](https://travis-ci.org/kwonoj/cld3-asm)

```js
loadModule({timeout?: number, environment?: ENVIRONMENT}): Promise<CldFactory>
loadModule({ timeout?: number }): Promise<CldFactory>
```
It allows to specify timeout to wait until wasm binary compliation & load. By default `cld3-asm` tries to detect running environment, but for some cases (i.e electron) it is possible to override.
It allows to specify timeout to wait until wasm binary compliation & load.

@@ -38,0 +38,0 @@ ## Creating language identifier

@@ -1,2 +0,1 @@

import { ENVIRONMENT } from 'emscripten-wasm-loader';
import { CldAsmModule, LanguageResult } from './cldAsmModule';

@@ -20,4 +19,4 @@ import { CldFactory } from './cldFactory';

*/
export const cldLoader = (asmModule: CldAsmModule, _environment?: ENVIRONMENT): CldFactory => {
const { cwrap, _free, allocateUTF8, _malloc, getValue, Pointer_stringify, setValue } = asmModule;
export const cldLoader = (asmModule: CldAsmModule): CldFactory => {
const { cwrap, _free, allocateUTF8, _malloc, getValue, UTF8ToString, setValue } = asmModule;
const cldInterface = wrapCldInterface(cwrap);

@@ -39,3 +38,3 @@

// grab constant values from cld3 library
const unknownIdentifier = Pointer_stringify(cldInterface.getUnknownIdentifier());
const unknownIdentifier = UTF8ToString(cldInterface.getUnknownIdentifier());
const minBytesDefault = cldInterface.getMinNumBytesDefault();

@@ -71,3 +70,3 @@ const maxBytesDefault = cldInterface.getMaxNumBytesDefault();

const ret: LanguageResult = {
language: Pointer_stringify(languageStringPtr) as LanguageCode,
language: UTF8ToString(languageStringPtr) as LanguageCode,
probability: getValue(structPtr + PTR_SIZE * 1, 'float'),

@@ -74,0 +73,0 @@ is_reliable: !!getValue(structPtr + PTR_SIZE * 2, 'i8'),

@@ -6,2 +6,1 @@ export { loadModule } from './loadModule';

export { LanguageCode } from './languageCode';
export { ENVIRONMENT } from 'emscripten-wasm-loader';

@@ -1,2 +0,2 @@

import { ENVIRONMENT, getModuleLoader, isNode } from 'emscripten-wasm-loader';
import { getModuleLoader } from 'emscripten-wasm-loader';
import { CldAsmModule } from './cldAsmModule';

@@ -7,2 +7,5 @@ import { CldFactory } from './cldFactory';

//imports MODULARIZED emscripten preamble
import * as runtime from './lib/node/cld3';
/**

@@ -14,3 +17,2 @@ * Load, initialize wasm binary to use actual cld wasm instances.

* @param {string | object} [InitOptions.locateBinary] - custom resolution logic for wasm binary. (not supported)
* @param {ENVIRONMENT} [InitOptions.environment] For overriding running environment
* It could be either remote endpoint url, or loader-returned object for bundler. Check examples/browser_* for references.

@@ -23,23 +25,12 @@ *

timeout: number;
environment?: ENVIRONMENT;
}> = {}
) => {
//imports MODULARIZED emscripten preamble
//tslint:disable-next-line:no-require-imports no-var-requires
const runtime = require(`./lib/cld3`);
const { timeout } = initOptions;
const { environment, timeout } = initOptions;
const env = environment ? environment : isNode() ? ENVIRONMENT.NODE : ENVIRONMENT.WEB;
log(`loadModule: loading cld3 wasm binary`, { initOptions });
//https://github.com/kwonoj/docker-hunspell-wasm/issues/63
//Build module object to construct wasm binary module via emscripten preamble.
//apply overridden environment values to custom patched hunspell preamble.
const overriddenModule = { ENVIRONMENT: env };
const moduleLoader = await getModuleLoader<CldFactory, CldAsmModule>(
(runtime: CldAsmModule) => cldLoader(runtime, env),
(runtime: CldAsmModule) => cldLoader(runtime),
runtime,
overriddenModule,
undefined,
{ timeout }

@@ -46,0 +37,0 @@ );

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

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

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