Skip to content

Commit

Permalink
Merge pull request #93 from kwonoj/feat-single-file
Browse files Browse the repository at this point in the history
Drop asm.js support, single file wasm binary
  • Loading branch information
kwonoj authored Nov 30, 2017
2 parents d412d0d + c1cebef commit 318c801
Show file tree
Hide file tree
Showing 28 changed files with 2,611 additions and 2,291 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@ cache:

env:
matrix:
- NODE_VER=4 FULL_VALIDATE=false
- NODE_VER=5 FULL_VALIDATE=false
- NODE_VER=6 FULL_VALIDATE=false
- NODE_VER=7 FULL_VALIDATE=false
- NODE_VER=8 FULL_VALIDATE=true

matrix:
fast_finish: true

before_install:
- nvm install $NODE_VER
- npm install -g npm@5.4.1
- npm install -g npm@5.6.0
- npm install -g greenkeeper-lockfile@1
- node -v && npm -v

Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
<a name="1.0.0"></a>
# [1.0.0](https://github.com/kwonoj/hunspell-asm/compare/v0.0.17...v1.0.0) (2017-11-30)


### Bug Fixes

* **package:** update nanoid to version 1.0.0 ([f69df27](https://github.com/kwonoj/hunspell-asm/commit/f69df27))


### Features

* **hunspell:** update hunspell into single file binary ([8b9e6ea](https://github.com/kwonoj/hunspell-asm/commit/8b9e6ea))
* **loadmodule:** support single file binary load ([16ff979](https://github.com/kwonoj/hunspell-asm/commit/16ff979))
* **logger:** enablelogger appends scope ([36c429c](https://github.com/kwonoj/hunspell-asm/commit/36c429c))


### BREAKING CHANGES

* **loadmodule:** now runs on native-wasm supported runtime only



<a name="0.0.17"></a>
## [0.0.17](https://github.com/kwonoj/hunspell-asm/compare/v0.0.16...v0.0.17) (2017-10-10)

Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Build status](https://ci.appveyor.com/api/projects/status/7s0r599r9h6r682g?svg=true)](https://ci.appveyor.com/project/kwonoj/hunspell-asm)
[![codecov](https://codecov.io/gh/kwonoj/hunspell-asm/branch/master/graph/badge.svg)](https://codecov.io/gh/kwonoj/hunspell-asm)
[![npm](https://img.shields.io/npm/v/hunspell-asm.svg)](https://www.npmjs.com/package/hunspell-asm)
[![node](https://img.shields.io/badge/node-=>4.0-blue.svg?style=flat)](https://www.npmjs.com/package/hunspell-asm)
[![node](https://img.shields.io/badge/node-=>8.0-blue.svg?style=flat)](https://www.npmjs.com/package/hunspell-asm)

# Hunspell-asm

Expand Down Expand Up @@ -31,12 +31,10 @@ const hunspellFactory = await loadModule();
`loadModule` loads wasm binary, initialize it, and returns factory function to create instance of hunspell.

```js
loadModule(binaryEndpoint?: string, environment?: ENVIRONMENT): Promise<HunspellFactory>
loadModule(environment?: ENVIRONMENT): Promise<HunspellFactory>
```

It accepts `binaryEndpoint` as optional parameter for mainly browser environment. Unlike node, browser can't access wasm / asm binary directly in filesystem but have to `fetch`. Provide endpoints for paths to `dist/src/lib/**/*.(wasm|mem)` and it'll be fetched runtime. On node, this endpoint can be used to override physical path to binaries.

Additionally it accepts `environment` as well, allow to set running environment and ignores internal runtime detection. This is mostly for [Electron](https://electron.atom.io/)'s renderer process where node.js and `fetch` are available both, to selectively opt-in which way to use. It is important to note `loadModule` doesn't interop incorrect option value matching, like try to load correct binary when supply endpoint to file path with set env to browser.
It accepts `environment` allow to set running environment and ignores internal runtime detection. This is mostly for [Electron](https://electron.atom.io/)'s renderer process where node.js and `fetch` are available both, to selectively opt-in which way to use. It is important to note `loadModule` doesn't interop incorrect option value matching, like try to load correct binary when supply endpoint to file path with set env to browser.

## Mounting files

Expand Down
4 changes: 1 addition & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
environment:
matrix:
# node.js
- nodejs_version: "6"
- nodejs_version: "7"
- nodejs_version: "8"

install:
- ps: Install-Product node $env:nodejs_version
- set PATH=%APPDATA%\npm;%PATH%
- npm install -g npm@5.6.0
- node -v && npm -v
- npm install

Expand Down
3 changes: 1 addition & 2 deletions examples/browser/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
//tslint:disable:no-console
import { isWasmEnabled } from 'emscripten-wasm-loader';
import { loadModule } from '../../src/index';
import { enableLogger } from '../../src/util/logger';
import { runHunspell } from '../runHunspell';

enableLogger(console.log.bind(console));

const runBrowserHunspell = async () => {
const hunspellFactory = await loadModule(`../../src/lib/${isWasmEnabled() ? 'wasm' : 'asm'}`);
const hunspellFactory = await loadModule();

const aff = await fetch('../../spec/__fixtures__/korean.aff');
const affBuffer = new Uint8Array(await aff.arrayBuffer());
Expand Down
3 changes: 0 additions & 3 deletions jest-hunspell-asm.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
],
"bail": true,
"mapCoverage": true,
"resetMocks": true,
"clearMocks": true,
"resetModules": true,
"testEnvironment": "node",
"moduleFileExtensions": [
"js",
Expand Down
3 changes: 0 additions & 3 deletions jest-hunspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"**/spec/hunspell/**/*-spec.ts"
],
"bail": true,
"resetMocks": true,
"clearMocks": true,
"resetModules": true,
"testEnvironment": "node",
"moduleFileExtensions": [
"js",
Expand Down
Loading

0 comments on commit 318c801

Please sign in to comment.