Skip to content

Commit

Permalink
Merge pull request #44 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 57679fa + 5caa0c1 commit 487e3d1
Show file tree
Hide file tree
Showing 23 changed files with 2,411 additions and 6,518 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
- npm install -g npm@5.6.0
- npm install -g greenkeeper-lockfile@1
- node -v && npm -v

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


### Features

* **cld3:** update cld3 into sigle file binary ([bb8dfa1](https://github.com/kwonoj/cld3-asm/commit/bb8dfa1))
* **loadmodule:** support single file binary load ([d7ab905](https://github.com/kwonoj/cld3-asm/commit/d7ab905))
* **logger:** enablelogger appends scope ([cc98f9e](https://github.com/kwonoj/cld3-asm/commit/cc98f9e))


### BREAKING CHANGES

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



<a name="0.0.11"></a>
## [0.0.11](https://github.com/kwonoj/cld3-asm/compare/v0.0.10...v0.0.11) (2017-11-04)

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/vko7m5l7brt5w9ok?svg=true)](https://ci.appveyor.com/project/kwonoj/cld3-asm)
[![codecov](https://codecov.io/gh/kwonoj/cld3-asm/branch/master/graph/badge.svg)](https://codecov.io/gh/kwonoj/cld3-asm)
[![npm](https://img.shields.io/npm/v/cld3-asm.svg)](https://www.npmjs.com/package/cld3-asm)
[![node](https://img.shields.io/badge/node-=>4.0-blue.svg?style=flat)](https://www.npmjs.com/package/cld3-asm)
[![node](https://img.shields.io/badge/node-=>8.0-blue.svg?style=flat)](https://www.npmjs.com/package/cld3-asm)
[![Greenkeeper badge](https://badges.greenkeeper.io/kwonoj/cld3-asm.svg)](https://greenkeeper.io/)

# cld3-asm
Expand Down Expand Up @@ -30,12 +30,10 @@ const cldFactory = await loadModule();
`loadModule` loads wasm binary, initialize it, and returns factory function to create instance of cld3 [language identifier.](https://github.com/kwonoj/cld3-asm/blob/1a86bb67abcebc2cd0e90a83149292eb044e4122/src/cldAsmModule.ts#L70-L97)

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

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` as option, allow to override 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.

## Creating language identifier

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 { runCld } from '../runCld';

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

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

runCld(cldFactory);
};
Expand Down
Loading

0 comments on commit 487e3d1

Please sign in to comment.