-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* migrate to vite * format * update pkg scripts * add type-checking to build * publish output dir * Add @babel/core for react-refresh * Remove @babel/core; bump @vitejs/plugin-react-refresh * bump typescript & vite * add geotiff comment' * rename: empty-geotiff.js -> empty:geotiff.js * Remove snowpack references * Simplify tsconfig * Create registration module * prettier * Add description to registration module
- Loading branch information
Showing
11 changed files
with
356 additions
and
1,785 deletions.
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ jobs: | |
with: | ||
node-version: '15.x' | ||
- run: npm install | ||
- run: npm run check | ||
- run: npm run lint | ||
|
||
# TODO: add tests |
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
Large diffs are not rendered by default.
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
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,10 @@ | ||
/* | ||
* This file provides an "empty" export of geotiff's | ||
* top-level API so that it may be aliased by vite | ||
* when resolving 'geotiff' as a dependency. | ||
* | ||
* This avoids trying to resolve any of geotiff's | ||
* inner, difficult to resolve exports. | ||
*/ | ||
export const fromUrl = ''; | ||
export const fromBlob = ''; |
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 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,30 @@ | ||
import { addCodec } from 'zarr'; | ||
import type { CodecConstructor } from 'numcodecs'; | ||
|
||
type CodecModule = { default: CodecConstructor<Record<string, unknown>> }; | ||
|
||
const cache: Map<string, Promise<CodecModule['default']>> = new Map(); | ||
|
||
function add(name: string, load: () => Promise<CodecModule>): void { | ||
// Cache import to avoid duplicate loads | ||
const loadAndCache = () => { | ||
if (!cache.has(name)) { | ||
const promise = load() | ||
.then((m) => m.default) | ||
.catch((err) => { | ||
cache.delete(name); | ||
throw err; | ||
}); | ||
cache.set(name, promise); | ||
} | ||
return cache.get(name)!; | ||
}; | ||
addCodec(name, loadAndCache); | ||
} | ||
|
||
// Add dynmaically imported codecs to Zarr.js registry. | ||
add('lz4', () => import('numcodecs/lz4')); | ||
add('gzip', () => import('numcodecs/gzip')); | ||
add('zlib', () => import('numcodecs/zlib')); | ||
add('zstd', () => import('numcodecs/zstd')); | ||
add('blosc', () => import('numcodecs/blosc')); |
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 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 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,18 @@ | ||
import { defineConfig } from 'vite'; | ||
import reactRefresh from '@vitejs/plugin-react-refresh'; | ||
|
||
import { resolve } from 'path'; | ||
|
||
export default defineConfig({ | ||
plugins: [reactRefresh()], | ||
build: { | ||
outDir: 'out', | ||
publicPath: process.env.VIZARR_PREFIX || './', | ||
}, | ||
resolve: { | ||
alias: { | ||
zarr: 'zarr/core', | ||
geotiff: resolve(__dirname, 'src/empty:geotiff.js'), | ||
}, | ||
}, | ||
}); |