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

hunspell-asm

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hunspell-asm - npm Package Compare versions

Comparing version 2.0.0-beta.2 to 2.0.0-beta.3

dist/cjs/createModuleLoader.js

12

CHANGELOG.md

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

<a name="2.0.0-beta.3"></a>
# [2.0.0-beta.3](https://github.com/kwonoj/hunspell-asm/compare/v2.0.0-beta.2...v2.0.0-beta.3) (2019-01-26)
### Features
* **hunspell:** bump up hunspell with asmjs ([845ee54](https://github.com/kwonoj/hunspell-asm/commit/845ee54))
* **loadasmmodule:** asmjs loader ([a620219](https://github.com/kwonoj/hunspell-asm/commit/a620219))
* **loadmodule:** reintroduce env override ([d2f651d](https://github.com/kwonoj/hunspell-asm/commit/d2f651d))
<a name="2.0.0-beta.2"></a>

@@ -2,0 +14,0 @@ # [2.0.0-beta.2](https://github.com/kwonoj/hunspell-asm/compare/v2.0.0-beta.1...v2.0.0-beta.2) (2018-11-02)

0

dist/cjs/Hunspell.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Hunspell.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=HunspellAsmModule.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=HunspellFactory.js.map

@@ -0,0 +0,0 @@ "use strict";

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

exports.loadModule = loadModule_1.loadModule;
var loadAsmModule_1 = require("./loadAsmModule");
exports.loadAsmModule = loadAsmModule_1.loadAsmModule;
var logger_1 = require("./util/logger");

@@ -7,0 +9,0 @@ exports.log = logger_1.log;

@@ -0,0 +0,0 @@ "use strict";

30

dist/cjs/loadModule.js

@@ -5,4 +5,3 @@ "use strict";

var tslib_1 = require("tslib");
var emscripten_wasm_loader_1 = require("emscripten-wasm-loader");
var hunspellLoader_1 = require("./hunspellLoader");
var createModuleLoader_1 = require("./createModuleLoader");
var logger_1 = require("./util/logger");

@@ -15,2 +14,3 @@ /**

* @param {string | object} [InitOptions.locateBinary] - custom resolution logic for wasm binary.
* @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.

@@ -20,22 +20,10 @@ *

*/
var loadModule = function (_a) {
var _b = _a === void 0 ? {} : _a, timeout = _b.timeout, locateBinary = _b.locateBinary;
var loadModule = function (initOptions) {
if (initOptions === void 0) { initOptions = {}; }
return tslib_1.__awaiter(_this, void 0, void 0, function () {
var runtimeModule, lookupBinary, overriddenModule, moduleLoader;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
logger_1.log("loadModule: loading hunspell module");
runtimeModule = emscripten_wasm_loader_1.isNode() ? require("./lib/hunspell_node") : require("./lib/hunspell_web");
lookupBinary = locateBinary || (function (_filePath) { return require('./lib/hunspell_web.wasm'); });
overriddenModule = emscripten_wasm_loader_1.isNode() && !locateBinary
? undefined
: {
locateFile: function (filePath) { return (filePath.endsWith('.wasm') ? lookupBinary(filePath) : filePath); }
};
return [4 /*yield*/, emscripten_wasm_loader_1.getModuleLoader(function (runtime) { return hunspellLoader_1.hunspellLoader(runtime, emscripten_wasm_loader_1.isNode() ? emscripten_wasm_loader_1.ENVIRONMENT.NODE : emscripten_wasm_loader_1.ENVIRONMENT.WEB); }, runtimeModule, overriddenModule, { timeout: timeout })];
case 1:
moduleLoader = _c.sent();
return [2 /*return*/, moduleLoader()];
}
var runtime;
return tslib_1.__generator(this, function (_a) {
logger_1.log("loadModule: loading hunspell wasm binary");
runtime = require("./lib/hunspell");
return [2 /*return*/, createModuleLoader_1.createModuleLoader(initOptions, runtime)];
});

@@ -42,0 +30,0 @@ });

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ENVIRONMENT } from 'emscripten-wasm-loader';

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

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

var _this = this;
import * as tslib_1 from "tslib";
import { ENVIRONMENT, getModuleLoader, isNode } from 'emscripten-wasm-loader';
import { hunspellLoader } from './hunspellLoader';
import { createModuleLoader } from './createModuleLoader';
import { log } from './util/logger';

@@ -12,2 +11,3 @@ /**

* @param {string | object} [InitOptions.locateBinary] - custom resolution logic for wasm binary.
* @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,22 +17,10 @@ *

*/
var loadModule = function (_a) {
var _b = _a === void 0 ? {} : _a, timeout = _b.timeout, locateBinary = _b.locateBinary;
var loadModule = function (initOptions) {
if (initOptions === void 0) { initOptions = {}; }
return tslib_1.__awaiter(_this, void 0, void 0, function () {
var runtimeModule, lookupBinary, overriddenModule, moduleLoader;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:
log("loadModule: loading hunspell module");
runtimeModule = isNode() ? require("./lib/hunspell_node") : require("./lib/hunspell_web");
lookupBinary = locateBinary || (function (_filePath) { return require('./lib/hunspell_web.wasm'); });
overriddenModule = isNode() && !locateBinary
? undefined
: {
locateFile: function (filePath) { return (filePath.endsWith('.wasm') ? lookupBinary(filePath) : filePath); }
};
return [4 /*yield*/, getModuleLoader(function (runtime) { return hunspellLoader(runtime, isNode() ? ENVIRONMENT.NODE : ENVIRONMENT.WEB); }, runtimeModule, overriddenModule, { timeout: timeout })];
case 1:
moduleLoader = _c.sent();
return [2 /*return*/, moduleLoader()];
}
var runtime;
return tslib_1.__generator(this, function (_a) {
log("loadModule: loading hunspell wasm binary");
runtime = require("./lib/hunspell");
return [2 /*return*/, createModuleLoader(initOptions, runtime)];
});

@@ -39,0 +27,0 @@ });

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ import * as nanoid from 'nanoid';

@@ -0,0 +0,0 @@ import { ENVIRONMENT } from 'emscripten-wasm-loader';

@@ -0,0 +0,0 @@ import { isMounted } from './isMounted';

@@ -0,0 +0,0 @@ import { enableLogger as emscriptenEnableLogger } from 'emscripten-wasm-loader';

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ /** @internal */

@@ -0,0 +0,0 @@ import { Hunspell } from './Hunspell';

@@ -0,0 +0,0 @@ import { ENVIRONMENT } from 'emscripten-wasm-loader';

export { loadModule } from './loadModule';
export { loadAsmModule } from './loadAsmModule';
export { HunspellFactory } from './HunspellFactory';

@@ -3,0 +4,0 @@ export { Hunspell } from './Hunspell';

@@ -0,0 +0,0 @@ import { FS } from './HunspellAsmModule';

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

import { HunspellFactory } from './HunspellFactory';
import { ENVIRONMENT } from 'emscripten-wasm-loader';
/**

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

* @param {string | object} [InitOptions.locateBinary] - custom resolution logic for wasm binary.
* @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.

@@ -13,7 +14,8 @@ *

*/
declare const loadModule: ({ timeout, locateBinary }?: Partial<{
declare const loadModule: (initOptions?: Partial<{
timeout: number;
locateBinary: (filePath: string) => string | object;
}>) => Promise<HunspellFactory>;
environment?: ENVIRONMENT | undefined;
}>) => Promise<import("./HunspellFactory").HunspellFactory>;
export { loadModule };
//# sourceMappingURL=loadModule.d.ts.map

@@ -0,0 +0,0 @@ import { FS } from './HunspellAsmModule';

@@ -0,0 +0,0 @@ import { FS } from './HunspellAsmModule';

@@ -0,0 +0,0 @@ import { ENVIRONMENT } from 'emscripten-wasm-loader';

@@ -0,0 +0,0 @@ import { FS } from './HunspellAsmModule';

@@ -0,0 +0,0 @@ declare type logFunctionType = (message: string, ...optionalParams: Array<any>) => void;

@@ -0,0 +0,0 @@ import { cwrapSignature } from './HunspellAsmModule';

{
"name": "hunspell-asm",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"description": "WebAssembly based Javascript bindings for hunspell spellchecker",

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

"types": "./dist/types/index.d.ts",
"browser": {
"./dist/cjs/lib/hunspell_node.js": "./dist/cjs/lib/hunspell_web.js",
"./dist/cjs/lib/hunspell_node.wasm": "./dist/cjs/lib/hunspell_web.wasm",
"./dist/esm/lib/hunspell_node.js": "./dist/esm/lib/hunspell_web.js",
"./dist/esm/lib/hunspell_node.wasm": "./dist/esm/lib/hunspell_web.wasm"
},
"config": {

@@ -19,3 +13,3 @@ "commitizen": {

},
"hunspell-version": "91c5123-181030"
"hunspell-version": "dab1b23-190125"
},

@@ -61,31 +55,31 @@ "lint-staged": {

"devDependencies": {
"@commitlint/cli": "^7.2.1",
"@commitlint/config-angular": "^7.1.2",
"@commitlint/cli": "^7.3.2",
"@commitlint/config-angular": "^7.3.1",
"@types/chai": "^4.1.7",
"@types/jest": "^23.3.9",
"@types/lodash": "^4.14.117",
"@types/node": "^10.12.2",
"@types/shelljs": "^0.8.0",
"@types/jest": "^23.3.13",
"@types/lodash": "^4.14.120",
"@types/node": "^10.12.18",
"@types/shelljs": "^0.8.2",
"chai": "^4.2.0",
"commitizen": "^3.0.4",
"commitizen": "^3.0.5",
"conventional-changelog-cli": "^2.0.11",
"husky": "^1.1.2",
"husky": "^1.3.1",
"jest": "^23.6.0",
"jest-spin-reporter": "^1.0.2",
"lint-staged": "^8.0.4",
"lint-staged": "^8.1.0",
"lodash": "^4.17.11",
"npm-run-all": "^4.1.3",
"prettier": "^1.14.3",
"npm-run-all": "^4.1.5",
"prettier": "^1.16.1",
"rxjs": "^6.3.3",
"shelljs": "^0.8.2",
"shelljs": "^0.8.3",
"shx": "^0.3.2",
"ts-jest": "^23.10.4",
"ts-jest": "^23.10.5",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"tslint": "^5.12.1",
"tslint-no-unused-expression-chai": "0.1.4",
"typescript": "^3.1.5"
"typescript": "^3.2.4"
},
"dependencies": {
"emscripten-wasm-loader": "^2.2.2",
"nanoid": "^1.3.3",
"nanoid": "^2.0.1",
"tslib": "^1.9.3",

@@ -92,0 +86,0 @@ "unixify": "^1.0.0"

@@ -9,4 +9,2 @@ [![Build Status](https://travis-ci.org/kwonoj/hunspell-asm.svg?branch=master)](https://travis-ci.org/kwonoj/hunspell-asm)

[![Greenkeeper badge](https://badges.greenkeeper.io/kwonoj/hunspell-asm.svg)](https://greenkeeper.io/)
`Hunspell-asm` is isomorphic javascript binding to [hunspell](https://github.com/hunspell/hunspell) spellchecker based on WebAssembly hunspell binary. This module aims to provide thin, lightweight interface to hunspell without requiring native modules.

@@ -13,0 +11,0 @@

export { loadModule } from './loadModule';
export { loadAsmModule } from './loadAsmModule';
export { HunspellFactory } from './HunspellFactory';

@@ -3,0 +4,0 @@ export { Hunspell } from './Hunspell';

@@ -1,5 +0,3 @@

import { ENVIRONMENT, getModuleLoader, isNode } from 'emscripten-wasm-loader';
import { HunspellAsmModule } from './HunspellAsmModule';
import { HunspellFactory } from './HunspellFactory';
import { hunspellLoader } from './hunspellLoader';
import { ENVIRONMENT } from 'emscripten-wasm-loader';
import { createModuleLoader } from './createModuleLoader';
import { log } from './util/logger';

@@ -13,2 +11,3 @@

* @param {string | object} [InitOptions.locateBinary] - custom resolution logic for wasm binary.
* @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.

@@ -18,36 +17,18 @@ *

*/
const loadModule = async ({
timeout,
locateBinary
}: Partial<{ timeout: number; locateBinary: (filePath: string) => string | object }> = {}) => {
log(`loadModule: loading hunspell module`);
const loadModule = async (
initOptions: Partial<{
timeout: number;
locateBinary: (filePath: string) => string | object;
environment?: ENVIRONMENT;
}> = {}
) => {
log(`loadModule: loading hunspell wasm binary`);
//imports MODULARIZED emscripten preamble
//tslint:disable-next-line:no-require-imports no-var-requires
const runtimeModule = isNode() ? require(`./lib/hunspell_node`) : require(`./lib/hunspell_web`);
const runtime = require(`./lib/hunspell`);
//tslint:disable-next-line:no-require-imports no-var-requires
const lookupBinary = locateBinary || ((_filePath: string) => require('./lib/hunspell_web.wasm'));
//Build module object to construct wasm binary module via emscripten preamble.
//This allows to override default wasm binary resolution in preamble.
//By default, hunspell-asm overrides to direct require to binary on *browser* environment to allow bundler like webpack resolves it.
//On node, it relies on default resolution logic.
const overriddenModule =
isNode() && !locateBinary
? undefined
: {
locateFile: (filePath: string) => (filePath.endsWith('.wasm') ? lookupBinary(filePath) : filePath)
};
const moduleLoader = await getModuleLoader<HunspellFactory, HunspellAsmModule>(
(runtime: HunspellAsmModule) => hunspellLoader(runtime, isNode() ? ENVIRONMENT.NODE : ENVIRONMENT.WEB),
runtimeModule,
overriddenModule,
{ timeout }
);
return moduleLoader();
return createModuleLoader(initOptions, runtime);
};
export { loadModule };

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