Skip to content

Commit

Permalink
Lean version of js without wasm bundled
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohnsullivan committed May 26, 2021
1 parent b8849f8 commit 9a57351
Show file tree
Hide file tree
Showing 16 changed files with 4,754 additions and 47 deletions.
3 changes: 3 additions & 0 deletions js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Rive.js Changelog

## 0.7.14
- Includes a lean JS build that does not bundle the wasm binary - rive.lean.dev.js; this is intended for those who want to serve the wasm binary independently of the js code. The overall download size will be smaller as the wasm binary is base64 encoded in the bundled version. Use ```RuntimeLoader.setWasmUrl()``` to provide the runtime with the location of the wasm binary prior to creating Rive objects.

## 0.7.13
- Fixes README in npm

Expand Down
19 changes: 19 additions & 0 deletions js/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Sets up the build structure expected by webpack and packs

# create the build dir
mkdir -p build/lean

# copy the rive wasm js and type definitions files to build dir
cp ../wasm/publish/rive.lean.mjs ./build/lean/wasm.js
cp ../wasm/publish/types.d.ts ./build/lean/wasm.d.ts

# Copy the rive runtime file to build dir
cp src/rive.ts build/lean/

# Replace the import statement at the top
sed -i '' '1s/.*/import * as rc from '"'"'.\/wasm'"'"';/' build/lean/rive.ts

# run web-pack
npm run build
6 changes: 2 additions & 4 deletions js/dist/rive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ export declare class RuntimeLoader {
private static isLoading;
private static callBackQueue;
private static rive;
private static wasmWebPath;
private static wasmFilePath;
private static testMode;
private static wasmURL;
private constructor();
private static loadRuntime;
static getInstance(callback: RuntimeCallback): void;
static awaitInstance(): Promise<rc.RiveCanvas>;
static setTestMode(mode: boolean): void;
static setWasmUrl(url: string): void;
}
export declare enum StateMachineInputType {
Number = 56,
Expand Down
22 changes: 7 additions & 15 deletions js/dist/rive.dev.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/dist/rive.dev.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 9a57351

Please sign in to comment.