Commit Graph

54 Commits

Author SHA1 Message Date
Jason Miller
6b0a675469 Fix SyntaxError for {}.nextTick 2020-04-01 12:09:57 -04:00
Ingvar Stepanyan
8e857cd393 Use native Wasm+Webpack support for Rust codecs
This delegates loading of Wasm modules to Webpack itself, making wrapper code simpler.

Emscripten-generated modules are still using custom loading glue as they're not compatible with Webpack.
2019-08-05 15:13:40 +01:00
Ingvar Stepanyan
78da9fd144 Fix build on Windows (#666)
* Use `require` for reading JSON

JSON is natively supported by Node.js, so no point in using a custom helper here.

* Fix build on Windows

Fixes #465.
2019-07-31 14:32:26 +01:00
Maciej Matuszewski
129c33fa12 Add basic history handling (#288) (#309)
* Add basic history handling (#288)

* Move history management to Compress component

* Remove unused pathname property from history

* Rename history listener functions

* Use history.back instead of history.replace

* Support going forward in history. Persist last selected file in runtime

* Add netlify redirects file

* Use 301 status code for redirect

* Cleanup _redirects file

* Use 200 status code for redirects

* Simplify onPopState function

* Always redirect to 301 with url rewrite

* Remove redundant history function

* Remove file check on render. Call openEditor synchronously

* Use pushState only if user is on the initial screen. Mount history listener in constructor

* Simplify openEditor condition

* Update early return condition

* Rolling abstractions back into the main component
2018-12-12 12:58:03 +00:00
Jake Archibald
428b7d976d Create CSS typings before build. Fixes #251. (#350)
* Create CSS typings before build

* Let's try this.

* Adding comment

* Remove hack from travis
2018-11-28 16:09:08 +00:00
Jason Miller
f11a6cb38a Fix build on Windows
Fixes #282.
2018-11-21 11:18:01 -05:00
Jake Archibald
f351712130 Building on #275 (#289)
* Upgrade devDependcies. Replace UglifyJS ⚰ with TerserJS 👶 Fix TypeScript compiler errors

* Remove babel and associated plugins

* Re-enable strictNullChecks and noImplicitAny

* Use surma's better ga type definition.
`ts-ignore` document.activeElement potential null warnings

* Avoiding ignores
2018-11-14 14:04:01 -08:00
Jake Archibald
2ca97ef586 Not entirely sure why this causes dev to fail, but this fixes it. 2018-11-10 16:10:25 -08:00
Jason Miller
6994cc3d15 _headers & _redirects generation (#240)
* Generate `_headers` and `_redirects` by passing assets through ejs templates.

* PR feedback

* Excluding service worker stuff from prerender

* Build SW in dev

* Let's give this a try

* lol

* Is this how it works?
2018-11-09 10:49:01 -08:00
Jake Archibald
71f893cb44 Enhanced offline (#249)
* Notification of updates & reloading

* Using version in service worker & allowing version to appear elsewhere

* Stupid file

* Ditching changelog for now. Using package json.

* Ugh.
2018-11-09 09:13:14 -08:00
Jason Miller
7616d33883 Startup optimizations (#226)
* Startup optimisations

* I hate this file

* Inline main script

* Reverting change to do a fairer perf comparison

* Inlining again. Weeeeee!

* Lockfile
2018-11-09 16:01:02 +00:00
Jason Miller
7d42d4f973 Add a serviceworker (#234)
* Add a serviceworker

* rename + fix random extra character

* Fixing worker typings

* Fixing types properly this time.

* Once of those rare cases where this matters.

* Naming the things.

* Move registration to the app (so we can use snackbar later)

* Moving SW plugin later so it picks up things like HTML

* MVP service worker

* Two stage-service worker

* Fix prerendering by conditionally awaiting Custom Elements polyfill.

* Fix icon 404's

* add doc comment to autoswplugin

* Fix type
2018-11-08 12:02:05 +00:00
Jake Archibald
e572b853e2 Snackbar defaults & copy undo (#233)
* Fix snackbar defaults. Fixes #205.

* Undo copy settings across.

* Oops

* Fixing stupid minification bug

* Something weird happened with the last commit
2018-11-06 13:44:15 +00:00
Jake Archibald
bdd3c11f1a Options ui (#222)
* wip

* Commenting stuff to keep the build happy

* Revealing sections

* Custom select elements & more form work

* Range input styles

* Text fields with inputs do the right thing

* Safari & Firefox fixes

* Large compress select

* oops

* MozJPEG options updated

* OptPNG options

* These asserts weren't true

* Generic options

* WebP options

* Hiding "edit" when "original image"

* Download icon

* Copy setting button - still not happy with this

* Progress indicator

* Loading icon enter/exit anim

* Preventing controls going under options

* Ahh so that's what was causing scrolling

* Ahh so that's what was causing outlines

* Simplifying range styles and fixing cross-browser

* Processing custom element styles

* Get precision from step by default

* I don't know how or when this happened.

* Don't need that many steps

* Avoid having an element that covers the pinch zoom

* Preventing overlap with zoom controls

* Prevent ts warning

* Fixing spinner position

* Simplifying FileSize
2018-11-06 13:36:23 +00:00
Jake Archibald
43def798e1 Two workers & worker termination (#198)
* Refactoring codecs

* Plugging in new processor

* Fixing decorator

* MozJPEG free issue

* Better worker aborting, and terminate workers that aren't used for 10 seconds

* Better comment

* Ooops, half-typed comment

* Uncommenting problematic line

* Surma fixed it!

* Abstracting WASM initialisation

* Better comment

* Don't need this.

* Adding ticket

* noInitalRun

* Reverting MozJPEG issue demo

* Making a const for worker timeout

* Inline docs

* Bail early rather than nesting

* Addressing nits
2018-10-28 09:17:43 +00:00
Jake Archibald
568b9e9459 Styling intro screen and adding demo images. 2018-10-12 14:12:32 +01:00
Surma
54ad30a7ed Optipng (#156)
* omg it’s compiling

* example actually works

* Expose compression level options

* Disable crypto and path module emulation in webpack

* Update README

* Remove small image

* Use -O3 on optipng

* Free memory after copy

* Handle unexpected file reader return types

* Rename level label to effort
2018-09-04 16:49:45 +01:00
Jake Archibald
f2f467ecb8 WebP encode options (#110)
* Flailing

* Holy shit struct binding

* Options in the encoder!

* Integrating webp options

* Addressing feedback

* This isn't needed anymore
2018-07-27 14:06:45 +01:00
Jason Miller
e8e151a926 Fix errors arising from strict .mjs handling. 2018-07-10 10:57:11 -04:00
Jason Miller
38d0057833 Switch to .mjs for ES Modules. Fixes #88. 2018-07-04 10:02:20 -04:00
Jason Miller
3035a68b90 Options UI (#39)
* Initial work to add Options config

* Use a single encoder instance and retry up to 10 times on failure.

* Switch both sides to allow encoding from the source image, add options configuration for each.

* Styling for options (and a few tweaks for the app)

* Dep updates.

* Remove commented out code.

* Fix Encoder typing

* Fix lint issues

* Apparently I didnt have tslint autofix enabled on the chromebook

* Attempt to fix layout/panning issues

* Fix missing custom element import!

* Fix variable naming, remove dynamic encoder names, remove retry, allow encoders to return ImageData.

* Refactor state management to use an Array of objects and immutable updates instead of relying on explicit update notifications.

* Add Identity encoder, which is a passthrough encoder that handles the "original" view.

* Drop comlink-loader into the project and add ".worker" to the jpeg encoder filename so it runs in a worker (🦄)

* lint fixes.

* cleanup

* smaller PR feedback fixes

* rename "jpeg" codec to "MozJpeg"

* Formatting fixes for Options

* Colocate codecs and their options UIs in src/codecs, and standardize the namings

* Handle canvas errors

* Throw if quality is undefined, add default quality

* add note about temp styles

* add note about temp styles [2]

* Renaming updateOption

* Clarify option input bindings

* Move updateCanvas() to util and rename to drawBitmapToCanvas

* use generics to pass through encoder options

* Remove unused dependencies

* fix options type

* const

* Use `Array.prototype.some()` for image loading check

* Display encoding errors in the UI.

* I fought typescript and I think I won

* This doesn't need to be optional

* Quality isn't optional

* Simplifying comlink casting

* Splitting counters into loading and displaying

* Still loading if the loading counter isn't equal.
2018-06-29 16:29:18 +01:00
Surma
d4a616713a Simplify webpack config 2018-05-21 13:29:24 +01:00
Surma
c2e2a1a0b6 Succesfully load wasm file via webpack 2018-05-17 16:04:56 +01:00
Surma
7edb7f0de8 Wrangling TypeScript and webpack to work with Emscripten wasm stuff 2018-05-17 11:24:40 +01:00
Jason Miller
e9eaf227bc Merge branch 'master' into firebase 2018-05-15 11:59:20 -04:00
Jake Archibald
b619427237 Removing everything that isn't skeletonyy (#22)
* Simplifying

* Ignoring CSS defs
2018-05-04 09:20:34 -07:00
Jason Miller
81aaadbabf Remove all prerendering & critical CSS stuff 2018-05-01 09:52:58 -04:00
Jason Miller
da53b5fedc Add more long-term caching headers, fix missing hash in main.css, switch Workbox to use locally generated files instead of Fastly (improves TTI), delay SW install by 1s. 2018-04-22 00:36:58 -04:00
Jason Miller
540b3c8154 Merge branch 'master' into prerendering 2018-04-17 21:35:28 -04:00
Jason Miller
06642fd047 Merge pull request #18 from GoogleChromeLabs/critters-async-await
Critters: async/await & font handling
2018-04-17 21:33:59 -04:00
Jason Miller
dec93a724f Fix for Workbox precaching way too many files 2018-04-17 14:08:23 -04:00
Jason Miller
411614b731 Output minimal stats to the console during build 2018-04-17 14:07:57 -04:00
Jason Miller
896d267de5 Add plugin to make script loading async 2018-04-17 14:07:42 -04:00
Jason Miller
e0c59577a4 Lint webpack config, and only preload initial chunks 2018-04-17 14:07:22 -04:00
Jason Miller
3ba0a5a22a Adds single-pass prerendering via a new prerender-loader 2018-04-17 14:04:55 -04:00
Jason Miller
be8fae10f8 Critters: move to async/await (fixes #16), add critical font inlining / preloading 2018-04-17 13:57:48 -04:00
Jason Miller
718443de30 Only use Babel to process .js files. 2018-04-17 13:42:25 -04:00
Jason Miller
919a259b0a Add option to make async leave a rel="preload" in the header and append a <link rel="stylesheet"> to the end of body. 2018-04-05 12:41:19 -04:00
Jason Miller
0066e20315 - Rename to critters-webpack-plugin
- Format output using pretty-bytes
- Insert inlined style tags immediately after their source link tags
- Add option to turn off external stylesheet processing
- Add `async` option that converts critical'd external sheets to `<link rel="preload" as="style" onload="this.rel='stylesheet'">`
2018-04-03 10:00:41 -04:00
Jason Miller
7bf2ba4690 Initial version of webpack-inline-critical-css-plugin 2018-04-02 22:51:01 -04:00
Jason Miller
1dd0366c05 Fix broken sourcemaps in the TypeScript+Babel setup, clean up webpack config, drop threaded type checking (couldn't get it working) 2018-03-30 16:25:20 -04:00
Jason Miller
76ceea0e52 tabs -> spaces 2018-03-29 15:43:14 -04:00
Jason Miller
5e6500d196 Use strict TypeScript, enable TSLint, update all types to work in strict mode. 2018-03-29 15:42:07 -04:00
Jason Miller
9977e5b8c6 add note about filter(Boolean) 2018-03-29 10:21:56 -04:00
Jason Miller
e347cbe413 Remove commented-out Webpack config and add explanatory comments to anything vague 2018-03-29 10:17:33 -04:00
Jason Miller
e0a10cf334 Drop custom preact alias 2018-03-29 10:15:13 -04:00
Jason Miller
83a0bd16dd infer NODE_ENV from isProd 2018-03-27 20:52:30 -04:00
Jason Miller
720a11ccd3 Error out if required (json) configs are missing/corrupted. 2018-03-27 20:50:58 -04:00
Jason Miller
a5e2952e8c Get rid of DeprecationWarning output filter 2018-03-27 20:48:57 -04:00
Jason Miller
465d043502 let -> const 2018-03-27 20:37:25 -04:00