-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Brotli compression #144
Conversation
# Conflicts: # package-lock.json # package.json
esbuild-plugins.mjs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mjs version swap and removing now unused wasm plugin
esbuild-serve.mjs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
esbuild-plugin-wat
does what we did, but better!
esbuild-shims.mjs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mjs conversion
} | ||
}) | ||
.then(() => { | ||
return Promise.all(testTargets.map(esbuild.build)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be after the other targets are built as it is dependent on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visible output!
lib/browser/brotli.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is mostly copied from https://github.com/httptoolkit/brotli-wasm?tab=readme-ov-file#in-browser-with-streams
lib/browser/compression.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with the typescript version!
@@ -27,7 +27,7 @@ export const unsupported = [ | |||
'delta_encoding_optional_column.parquet', // DELTA_BINARY_PACKED unsupported | |||
'delta_encoding_required_column.parquet', // DELTA_BINARY_PACKED unsupported | |||
'delta_length_byte_array.parquet', // ZSTD unsupported, DELTA_BINARY_PACKED unsupported | |||
'large_string_map.brotli.parquet', // BUG? | |||
'large_string_map.brotli.parquet', // Fails as the large string is > 1 GB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This took a while to figure out. It is a small file, but the large string test is very large. Too much for js for the most part.
@@ -216,6 +216,15 @@ describe('test-files', function () { | |||
} | |||
}); | |||
|
|||
describe('Brotli compression', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works!
sourcemap: 'external', | ||
bundle: true, | ||
minify: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping minify off here for the local serve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the examples and reviewed the code. Looks good to go, glad you found it was mainly a poor example file.
Note: The reference Brotli file doesn't work because it is too large. It decompresses to an extremely large size (1Gb+)
Closes #140
Closes #125 (Likely?)
A new brotli sample file was generated using python code seen below.
What Changed?
esbuild-plugin-wat
which worked better than the copy-pasted one from esbuildTesting!
npm i
npm run build:browser
npx serve .
open http://localhost:3000/test/browser/
in your preferred browseropen http://localhost:3000/
in your preferred browserBrotli Sample File generation script