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 0.0.14 to 0.0.15

dist/src/getLoader.d.ts

15

CHANGELOG.md

@@ -0,1 +1,16 @@

<a name="0.0.15"></a>
## [0.0.15](https://github.com/kwonoj/hunspell-asm/compare/v0.0.14...v0.0.15) (2017-09-21)
### Bug Fixes
* **mountdirectory:** accept environment instead of internal detect ([b24dcee](https://github.com/kwonoj/hunspell-asm/commit/b24dcee))
### Features
* **loadmodule:** fallback to asm.js when wasm load fail ([bac803c](https://github.com/kwonoj/hunspell-asm/commit/bac803c))
<a name="0.0.14"></a>

@@ -2,0 +17,0 @@ ## [0.0.14](https://github.com/kwonoj/hunspell-asm/compare/v0.0.13...v0.0.14) (2017-09-18)

3

dist/src/hunspellLoader.d.ts

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

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

@@ -12,2 +13,2 @@ import { HunspellFactory } from './HunspellFactory';

/** @internal */
export declare const hunspellLoader: (asmModule: HunspellAsmModule) => HunspellFactory;
export declare const hunspellLoader: (asmModule: HunspellAsmModule, environment: ENVIRONMENT) => HunspellFactory;

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

/** @internal */
exports.hunspellLoader = function (asmModule) {
exports.hunspellLoader = function (asmModule, environment) {
var cwrap = asmModule.cwrap, FS = asmModule.FS, stringToUTF8 = asmModule.stringToUTF8, Runtime = asmModule.Runtime, getValue = asmModule.getValue, Pointer_stringify = asmModule.Pointer_stringify;

@@ -28,3 +28,3 @@ var hunspellInterface = wrapHunspellInterface_1.wrapHunspellInterface(cwrap);

var nodePathId = "/" + nanoid(45);
if (emscripten_wasm_loader_1.isNode()) {
if (environment === emscripten_wasm_loader_1.ENVIRONMENT.NODE) {
FS.mkdir(nodePathId);

@@ -40,3 +40,3 @@ logger_1.log("hunspellLoader: mount path for directory created at " + nodePathId);

return {
mountDirectory: mountDirectory_1.mountDirectory(FS, nodePathId),
mountDirectory: mountDirectory_1.mountDirectory(FS, nodePathId, environment),
mountBuffer: mountBuffer_1.mountBuffer(FS, memPathId),

@@ -43,0 +43,0 @@ unmount: unmount_1.unmount(FS, memPathId),

import { ENVIRONMENT } from 'emscripten-wasm-loader';
import { HunspellFactory } from './HunspellFactory';
export declare const loadModule: (binaryEndpoint?: string, environment?: ENVIRONMENT) => Promise<HunspellFactory>;
/**
* Load, initialize wasm / asm.js binary to use actual cld wasm instances.
*
* @param {binaryEndpoint} [string] For overring path to wasm binary on node.js or browser.
* @param {environment} [ENVIRONMENT] For overriding running environment
*
* @returns {Promise<HunspellFactory>} Factory function of cld to allow create instance of hunspell.
*/
declare const loadModule: (binaryEndpoint?: string, environment?: ENVIRONMENT) => Promise<HunspellFactory>;
export { loadModule };
"use strict";
var _this = this;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var emscripten_wasm_loader_1 = require("emscripten-wasm-loader");
var hunspellLoader_1 = require("./hunspellLoader");
var getLoader_1 = require("./getLoader");
var logger_1 = require("./util/logger");
var asmPath = "./lib/" + (emscripten_wasm_loader_1.isWasmEnabled() ? 'wasm' : 'asm');
logger_1.log("loadModule: load hunspell module loader from ", asmPath);
//imports MODULARIZED emscripten preamble
//tslint:disable-next-line:no-require-imports no-var-requires
var runtimeModule = require(asmPath + "/hunspell");
exports.loadModule = emscripten_wasm_loader_1.getModuleLoader(function (runtime) { return hunspellLoader_1.hunspellLoader(runtime); }, {
//tslint:disable-next-line:no-require-imports
dir: emscripten_wasm_loader_1.isNode() ? require('path').dirname(require.resolve(asmPath + "/hunspell")) : null,
runtimeModule: runtimeModule
});
/**
* Load, initialize wasm / asm.js binary to use actual cld wasm instances.
*
* @param {binaryEndpoint} [string] For overring path to wasm binary on node.js or browser.
* @param {environment} [ENVIRONMENT] For overriding running environment
*
* @returns {Promise<HunspellFactory>} Factory function of cld to allow create instance of hunspell.
*/
var loadModule = function (binaryEndpoint, environment) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
var binaryPath, e_1;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
binaryPath = "./lib/" + (emscripten_wasm_loader_1.isWasmEnabled() ? 'wasm' : 'asm');
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 7]);
return [4 /*yield*/, getLoader_1.getLoader(binaryPath, binaryEndpoint, environment)];
case 2: return [2 /*return*/, _a.sent()];
case 3:
e_1 = _a.sent();
logger_1.log("loadModule: cannot load module from ", binaryPath);
if (!!emscripten_wasm_loader_1.isWasmEnabled()) return [3 /*break*/, 4];
throw e_1;
case 4:
logger_1.log("loadModule: try to fallback to asm.js runtime");
return [4 /*yield*/, getLoader_1.getLoader("./lib/asm", binaryEndpoint, environment)];
case 5: return [2 /*return*/, _a.sent()];
case 6: return [3 /*break*/, 7];
case 7: return [2 /*return*/];
}
});
}); };
exports.loadModule = loadModule;
//# sourceMappingURL=loadModule.js.map

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

import { ENVIRONMENT } from 'emscripten-wasm-loader';
import { FS } from './HunspellAsmModule';

@@ -13,2 +14,2 @@ /**

/** @internal */
export declare const mountDirectory: (FS: FS, nodePathId: string) => (dirPath: string) => string;
export declare const mountDirectory: (FS: FS, nodePathId: string, environment: ENVIRONMENT) => (dirPath: string) => string;

@@ -19,4 +19,4 @@ "use strict";

/** @internal */
exports.mountDirectory = function (FS, nodePathId) { return function (dirPath) {
if (!emscripten_wasm_loader_1.isNode()) {
exports.mountDirectory = function (FS, nodePathId, environment) { return function (dirPath) {
if (environment !== emscripten_wasm_loader_1.ENVIRONMENT.NODE) {
throw new Error('Mounting physical directory is not supported other than node.js environment');

@@ -23,0 +23,0 @@ }

{
"name": "hunspell-asm",
"version": "0.0.14",
"version": "0.0.15",
"description": "WebAssembly based Javascript bindings for hunspell spellchecker",

@@ -62,10 +62,10 @@ "main": "./dist/src/index.js",

"husky": "^0.14.3",
"jest": "^21.0.2",
"lint-staged": "^4.0.1",
"jest": "^21.1.0",
"lint-staged": "^4.2.1",
"lodash": "^4.17.4",
"npm-run-all": "^4.0.2",
"prettier": "^1.5.2",
"prettier": "^1.7.0",
"rxjs": "^5.4.2",
"shx": "^0.2.2",
"ts-jest": "^21.0.0",
"ts-jest": "^21.0.1",
"ts-node": "^3.2.0",

@@ -77,5 +77,5 @@ "tslint": "^5.5.0",

"dependencies": {
"emscripten-wasm-loader": "0.0.5",
"emscripten-wasm-loader": "0.0.7",
"getroot": "^1.0.0",
"nanoid": "^0.2.0",
"nanoid": "^0.2.1",
"tslib": "^1.7.1",

@@ -82,0 +82,0 @@ "unixify": "^1.0.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

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