Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed May 19, 2023
1 parent f1cf16a commit e274309
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
5 changes: 3 additions & 2 deletions modules/compression/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
"util": false
},
"scripts": {
"pre-build": "npm run build-bundle && npm run build-worker",
"pre-build": "npm run build-bundle && npm run build-bundle && npm run build-worker",
"build-bundle": "esbuild src/bundle.ts --outfile=dist/dist.min.js --bundle --minify --sourcemap --external:{fs,path,crypto}",
"build-worker": "esbuild src/workers/worker.ts --outfile=dist/compression-worker.js --target=esnext,node12 --bundle --minify --sourcemap --external:{fs,path,crypto} --define:__VERSION__=\\\"$npm_package_version\\\""
"build-worker": "esbuild src/workers/worker.ts --outfile=dist/compression-worker.js --target=esnext,node12 --bundle --minify --sourcemap --external:{fs,path,crypto} --define:__VERSION__=\\\"$npm_package_version\\\"",
"build-worker-node": "esbuild src/workers/worker.ts --outfile=dist/compression-worker-node.js --platform=node --target=esnext,node12 --bundle --minify --sourcemap --external:{fs,path,crypto} --define:__VERSION__=\\\"$npm_package_version\\\""
},
"dependencies": {
"@babel/runtime": "^7.3.1",
Expand Down
3 changes: 3 additions & 0 deletions modules/compression/src/workers/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import lz4js from 'lz4js';
// import lzo from 'lzo';
// import {ZstdCodec} from 'zstd-codec';

// globalThis.Worker = globalThis.Worker || {};
// globalThis.Blob = globalThis.Blob || {};

// Inject large dependencies through Compression constructor options
const modules = {
// brotli has problems with decompress in browsers
Expand Down
12 changes: 12 additions & 0 deletions modules/compression/test/compression.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ test('compression#batched', async (t) => {
// WORKER TESTS

test('gzip#worker', async (t) => {
if (!isBrowser) {
t.comment('not testing worker under Node.js');
t.end();
return;
}

const COMPRESSED_LENGTH_EXPECTED = 12824; // fflate
// const COMPRESSED_LENGTH_EXPECTED = 12825; // pako

Expand Down Expand Up @@ -204,6 +210,12 @@ test('gzip#worker', async (t) => {
});

test('lz4#worker', async (t) => {
if (!isBrowser) {
t.comment('not testing worker under Node.js');
t.end();
return;
}

const {binaryData} = getData();

t.equal(binaryData.byteLength, 100000, 'Length correct');
Expand Down
5 changes: 3 additions & 2 deletions modules/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
"README.md"
],
"scripts": {
"pre-build": "npm run build-worker && npm run build-bundle",
"pre-build": "npm run build-worker && npm run build-worker-node && npm run build-bundle",
"build-bundle": "esbuild src/bundle.ts --outfile=dist/dist.min.js --bundle --minify --sourcemap",
"build-worker": "esbuild src/workers/worker.ts --outfile=dist/crypto-worker.js --target=esnext,node12 --bundle --minify --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
"build-worker": "esbuild src/workers/worker.ts --outfile=dist/crypto-worker.js --target=esnext,node12 --bundle --minify --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\"",
"build-worker-node": "esbuild src/workers/worker.ts --outfile=dist/crypto-worker-node.js --platform=node --target=esnext,node12 --bundle --minify --sourcemap --define:__VERSION__=\\\"$npm_package_version\\\""
},
"dependencies": {
"@babel/runtime": "^7.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const DATA_URL = '@loaders.gl/draco/test/data/raw-attribute-buffers/lidar-positi

test('makeIterator(fetch)#async iterate', async (t) => {
const response = await fetchFile(DATA_URL);
const stream = response.body;
const stream = await response.body;

Check warning on line 67 in modules/loader-utils/test/lib/iterators/make-iterator.spec.ts

View workflow job for this annotation

GitHub Actions / test (16)

Unexpected `await` of a non-Promise (non-"Thenable") value
t.ok(stream);

if (stream) {
Expand Down

0 comments on commit e274309

Please sign in to comment.