forked from ZJONSSON/parquetjs
-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6303cc9
For node, use zlib for brotli
wilwade 4080b3f
Adding an html output to the example
wilwade ae55300
Add additional examples
wilwade 252a403
Updating compression for node and web
wilwade d90bdcc
Add additional browser test and docs on how to run it in a browser
wilwade 6e755dd
Attempting to add Brotli to browser
wilwade 699f879
Browser version of compress.ts
wilwade c95b8bc
Fix esbuild files to use modules
wilwade 380fd7c
Add note to failing reference test
wilwade fee18a2
Brotli working in the browser and node
wilwade 6c5d024
Add example file to example server
wilwade 870e78d
Fix serve issue
wilwade 8b0ba53
Docs fix
wilwade 1a8026c
Remove unneeded logs
wilwade 9ddc9fb
Remove comment
wilwade 5ec71df
Remove bad test
wilwade c6c1900
Fix lint issues
wilwade 23e281c
Update gitignore
wilwade 45be2f3
Update test for merge
wilwade 3d4146b
Update esbuild.mjs
wilwade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ dist | |
!test/reference-test/files/*.parquet | ||
examples/server/package-lock.json | ||
test/browser/*.js | ||
main.js | ||
main.js.map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import path from 'node:path'; | ||
/** | ||
* this plugin resolves to a browser version of compression.ts that uses different code for browsers | ||
*/ | ||
export const compressionBrowserPlugin = { | ||
name: 'compressionBrowser', | ||
setup(build) { | ||
build.onResolve({ filter: /^\.\/compression$/ }, (args) => { | ||
return { path: path.join(args.resolveDir, args.path.replace('compression', 'browser/compression.ts')) }; | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { Buffer as buffer } from 'buffer/'; | ||
export let Buffer = buffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const esbuild = require('esbuild'); | ||
const path = require('path'); | ||
const { compressionBrowserPlugin, wasmPlugin } = require('./esbuild-plugins'); | ||
import esbuild from 'esbuild'; | ||
import watPlugin from 'esbuild-plugin-wat'; | ||
import { compressionBrowserPlugin } from './esbuild-plugins.mjs'; | ||
// esbuild has TypeScript support by default | ||
const baseConfig = { | ||
bundle: true, | ||
|
@@ -10,11 +10,11 @@ const baseConfig = { | |
'process.env.NODE_ENV': '"production"', | ||
global: 'window', | ||
}, | ||
inject: ['./esbuild-shims.js'], | ||
inject: ['./esbuild-shims.mjs'], | ||
minify: true, | ||
mainFields: ['browser', 'module', 'main'], | ||
platform: 'browser', // default | ||
plugins: [compressionBrowserPlugin, wasmPlugin], | ||
plugins: [compressionBrowserPlugin, watPlugin()], | ||
target: 'es2020', // default | ||
}; | ||
// configuration for generating test code in browser | ||
|
@@ -26,39 +26,53 @@ const testConfig = { | |
'process.env.NODE_ENV': '"production"', | ||
global: 'window', | ||
}, | ||
inject: ['./esbuild-shims.js'], | ||
inject: ['./esbuild-shims.mjs'], | ||
minify: false, | ||
mainFields: ['browser', 'module', 'main'], | ||
platform: 'browser', // default | ||
plugins: [compressionBrowserPlugin, wasmPlugin], | ||
plugins: [compressionBrowserPlugin, watPlugin()], | ||
target: 'es2020', // default | ||
}; | ||
const targets = [ | ||
{ | ||
...baseConfig, | ||
globalName: 'parquetjs', | ||
outdir: path.resolve(__dirname, 'dist', 'browser'), | ||
outdir: './dist/browser', | ||
}, | ||
{ | ||
...baseConfig, | ||
format: 'esm', | ||
outfile: path.resolve(__dirname, 'dist', 'browser', 'parquet.esm.js'), | ||
outfile: 'dist/browser/parquet.esm.js', | ||
}, | ||
{ | ||
...baseConfig, | ||
format: 'cjs', | ||
outfile: path.resolve(__dirname, 'dist', 'browser', 'parquet.cjs.js'), | ||
outfile: 'dist/browser/parquet.cjs.js', | ||
}, | ||
// Browser test code below | ||
]; | ||
|
||
// Browser test code below is only in ESM | ||
const testTargets = [ | ||
{ | ||
...testConfig, | ||
outfile: path.resolve(__dirname, 'test', 'browser', 'main.js'), | ||
format: 'esm', | ||
mainFields: ['module', 'main'], | ||
outfile: 'test/browser/main.js', | ||
}, | ||
]; | ||
|
||
Promise.all(targets.map(esbuild.build)) | ||
.then((results) => { | ||
if (results.reduce((m, r) => m && !r.warnings.length, true)) { | ||
console.log('built with no errors or warnings'); | ||
console.log('built dist targets with no errors or warnings'); | ||
} | ||
}) | ||
.then(() => { | ||
return Promise.all(testTargets.map(esbuild.build)); | ||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
.then((results) => { | ||
if (results.reduce((m, r) => m && !r.warnings.length, true)) { | ||
console.log('built test targets with no errors or warnings'); | ||
} | ||
}) | ||
.catch((e) => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.