Compare commits

...

14 Commits

Author SHA1 Message Date
Jake Archibald
1ace858bfe Fixing others 2019-02-21 15:02:17 +00:00
Jake Archibald
0388bde540 Missed these 2019-02-21 12:48:09 +00:00
Jake Archibald
26fb713560 Fixing windows build. Fixes #465 2019-02-18 13:56:57 +00:00
Jake Archibald
e801170496 1.3.3 2019-02-15 09:49:34 +00:00
Surma
91e7c9c5ad Make Rust rotate code smaller (#462)
* Make Rust rotate code smaller

* Back on the rust happy path
2019-02-15 09:47:26 +00:00
Jake Archibald
ca5162ed32 Updating package lock to fix Netlify 2019-02-13 15:08:56 +00:00
Surma
0bf87d0c87 Merge pull request #461 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.26
2019-02-13 14:02:00 +00:00
renovate[bot]
ce91eb5bae Update dependency @types/node to v10.12.26 2019-02-13 00:00:41 +00:00
Surma
8d68056bca Merge pull request #457 from GoogleChromeLabs/renovate/chokidar-2.x
Update dependency chokidar to v2.1.1
2019-02-12 13:24:03 +00:00
renovate[bot]
d0de8e444a Update dependency chokidar to v2.1.1 2019-02-12 12:17:17 +00:00
Surma
dfef1f21cc Merge pull request #455 from GoogleChromeLabs/renovate/node-10.x
Update dependency @types/node to v10.12.25
2019-02-12 12:16:17 +00:00
renovate[bot]
2440ac4e87 Update dependency @types/node to v10.12.25 2019-02-12 11:09:55 +00:00
Surma
e90db78697 Merge pull request #459 from GoogleChromeLabs/renovate/webpack-bundle-analyzer-3.x
Update dependency webpack-bundle-analyzer to v3.0.4
2019-02-12 11:09:08 +00:00
renovate[bot]
5ae15d429c Update dependency webpack-bundle-analyzer to v3.0.4 2019-02-12 10:54:25 +00:00
8 changed files with 328 additions and 199 deletions

2
codecs/rotate/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
target
Cargo.lock

14
codecs/rotate/Cargo.toml Normal file
View File

@@ -0,0 +1,14 @@
[package]
name = "rotate"
version = "0.1.0"
authors = ["Surma <surma@google.com>"]
edition = "2018"
[lib]
name = "rotate"
path = "rotate.rs"
crate-type = ["cdylib", "rlib"]
[profile.release]
lto = true
opt-level = "s"

View File

@@ -7,12 +7,11 @@ echo "Compiling wasm"
echo "=============================================" echo "============================================="
( (
rustup run nightly \ rustup run nightly \
rustc \ cargo build \
--target=wasm32-unknown-unknown \ --target wasm32-unknown-unknown \
-C opt-level=3 \ --release
-o rotate.wasm \ cp target/wasm32-unknown-unknown/release/rotate.wasm .
rotate.rs wasm-strip rotate.wasm
wasm-strip rotate.wasm
) )
echo "=============================================" echo "============================================="
echo "Compiling wasm done" echo "Compiling wasm done"

View File

@@ -1,8 +1,22 @@
#![no_std] use std::slice::from_raw_parts_mut;
#![no_main]
use core::panic::PanicInfo; // This function is taken from
use core::slice::from_raw_parts_mut; // https://rustwasm.github.io/book/reference/code-size.html
#[cfg(not(debug_assertions))]
#[inline]
pub fn unwrap_abort<T>(o: Option<T>) -> T {
use std::process;
match o {
Some(t) => t,
None => process::abort(),
}
}
// Normal panic-y behavior for debug builds
#[cfg(debug_assertions)]
unsafe fn unchecked_unwrap<T>(o: Option<T>) -> T {
o.unwrap()
}
#[no_mangle] #[no_mangle]
fn rotate(input_width: isize, input_height: isize, rotate: isize) { fn rotate(input_width: isize, input_height: isize, rotate: isize) {
@@ -69,13 +83,8 @@ fn rotate(input_width: isize, input_height: isize, rotate: isize) {
for d2 in 0..d2_limit { for d2 in 0..d2_limit {
for d1 in 0..d1_limit { for d1 in 0..d1_limit {
let in_idx = (d1_start + d1 * d1_advance) * d1_multiplier + (d2_start + d2 * d2_advance) * d2_multiplier; let in_idx = (d1_start + d1 * d1_advance) * d1_multiplier + (d2_start + d2 * d2_advance) * d2_multiplier;
out_b[i as usize] = in_b[in_idx as usize]; *unwrap_abort(out_b.get_mut(i as usize)) = *unwrap_abort(in_b.get(in_idx as usize));
i += 1; i += 1;
} }
} }
} }
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}

Binary file not shown.

449
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{ {
"private": true, "private": true,
"name": "squoosh", "name": "squoosh",
"version": "1.3.2", "version": "1.3.3",
"license": "apache-2.0", "license": "apache-2.0",
"scripts": { "scripts": {
"start": "webpack-dev-server --host 0.0.0.0 --hot", "start": "webpack-dev-server --host 0.0.0.0 --hot",
@@ -16,13 +16,13 @@
} }
}, },
"devDependencies": { "devDependencies": {
"@types/node": "10.12.23", "@types/node": "10.12.26",
"@types/pretty-bytes": "5.1.0", "@types/pretty-bytes": "5.1.0",
"@types/webassembly-js-api": "0.0.2", "@types/webassembly-js-api": "0.0.2",
"@webcomponents/custom-elements": "1.2.1", "@webcomponents/custom-elements": "1.2.1",
"@webpack-cli/serve": "0.1.3", "@webpack-cli/serve": "0.1.3",
"assets-webpack-plugin": "3.9.7", "assets-webpack-plugin": "3.9.7",
"chokidar": "2.1.0", "chokidar": "2.1.1",
"chalk": "2.4.2", "chalk": "2.4.2",
"classnames": "2.2.6", "classnames": "2.2.6",
"clean-webpack-plugin": "1.0.1", "clean-webpack-plugin": "1.0.1",
@@ -67,7 +67,7 @@
"typescript": "3.2.4", "typescript": "3.2.4",
"url-loader": "1.1.2", "url-loader": "1.1.2",
"webpack": "4.28.0", "webpack": "4.28.0",
"webpack-bundle-analyzer": "3.0.3", "webpack-bundle-analyzer": "3.0.4",
"webpack-cli": "3.2.3", "webpack-cli": "3.2.3",
"webpack-dev-server": "3.1.14", "webpack-dev-server": "3.1.14",
"worker-plugin": "3.0.0" "worker-plugin": "3.0.0"

View File

@@ -17,6 +17,8 @@ const CrittersPlugin = require('critters-webpack-plugin');
const AssetTemplatePlugin = require('./config/asset-template-plugin'); const AssetTemplatePlugin = require('./config/asset-template-plugin');
const addCssTypes = require('./config/add-css-types'); const addCssTypes = require('./config/add-css-types');
const regexpPathSep = path.sep === '\\' ? '\\\\' : '/';
function readJson (filename) { function readJson (filename) {
return JSON.parse(fs.readFileSync(filename)); return JSON.parse(fs.readFileSync(filename));
} }
@@ -38,7 +40,7 @@ module.exports = async function (_, env) {
return { return {
mode: isProd ? 'production' : 'development', mode: isProd ? 'production' : 'development',
entry: { entry: {
'first-interaction': './src/index' 'first-interaction': path.join('.', 'src', 'index'),
}, },
devtool: isProd ? 'source-map' : 'inline-source-map', devtool: isProd ? 'source-map' : 'inline-source-map',
stats: 'minimal', stats: 'minimal',
@@ -52,13 +54,13 @@ module.exports = async function (_, env) {
resolve: { resolve: {
extensions: ['.ts', '.tsx', '.mjs', '.js', '.scss', '.css'], extensions: ['.ts', '.tsx', '.mjs', '.js', '.scss', '.css'],
alias: { alias: {
style: path.join(__dirname, 'src/style') style: path.join(__dirname, 'src', 'style')
} }
}, },
resolveLoader: { resolveLoader: {
alias: { alias: {
// async-component-loader returns a wrapper component that waits for the import to load before rendering: // async-component-loader returns a wrapper component that waits for the import to load before rendering:
async: path.join(__dirname, 'config/async-component-loader') async: path.join(__dirname, 'config', 'async-component-loader')
} }
}, },
module: { module: {
@@ -147,11 +149,11 @@ module.exports = async function (_, env) {
}, },
{ {
// All the codec files define a global with the same name as their file name. `exports-loader` attaches those to `module.exports`. // All the codec files define a global with the same name as their file name. `exports-loader` attaches those to `module.exports`.
test: /\/codecs\/.*\.js$/, test: new RegExp(`${regexpPathSep}codecs${regexpPathSep}.*\.js`),
loader: 'exports-loader' loader: 'exports-loader'
}, },
{ {
test: /\/codecs\/.*\.wasm$/, test: new RegExp(`${regexpPathSep}codecs${regexpPathSep}.*\.wasm`),
// This is needed to make webpack NOT process wasm files. // This is needed to make webpack NOT process wasm files.
// See https://github.com/webpack/webpack/issues/6725 // See https://github.com/webpack/webpack/issues/6725
type: 'javascript/auto', type: 'javascript/auto',
@@ -172,7 +174,7 @@ module.exports = async function (_, env) {
plugins: [ plugins: [
new webpack.IgnorePlugin( new webpack.IgnorePlugin(
/(fs|crypto|path)/, /(fs|crypto|path)/,
new RegExp(`${path.sep}codecs${path.sep}`) new RegExp(`${regexpPathSep}codecs${regexpPathSep}`)
), ),
// Pretty progressbar showing build progress: // Pretty progressbar showing build progress: