Skip to content

Commit

Permalink
chore: update dev depenedencies (#704)
Browse files Browse the repository at this point in the history
- Update TypeScript
- Update Vite
- Update unbuild
- Update eslint
  • Loading branch information
manzt authored Nov 10, 2023
1 parent 7d5de72 commit a16934d
Show file tree
Hide file tree
Showing 19 changed files with 1,770 additions and 844 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Changed
- Bump `gl` to v6 and move to Node.js 18 in CI.
- Narrow required interface for `ZarrPixelSource`.
- Update dev dependencies

## 0.13.8

Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,28 @@
"@deck.gl/extensions": "~8.8.6",
"@deck.gl/mesh-layers": "~8.8.6",
"@deck.gl/test-utils": "~8.8.6",
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@luma.gl/test-utils": "~8.5.16",
"@pnpm/meta-updater": "^0.0.6",
"@pnpm/types": "^8.4.0",
"@probe.gl/test-utils": "^3.5.0",
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"esbuild": "^0.14.42",
"eslint": "^8.16.0",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^4.5.0",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"esbuild": "^0.19.5",
"eslint": "^8.53.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"esno": "^0.16.3",
"gl": "^6.0.2",
"prettier": "^2.6.2",
"tap-spec": "^5.0.0",
"tape": "^5.5.3",
"tape-catch": "^1.0.6",
"tape-run": "^10.0.0",
"typescript": "^4.6.4",
"unbuild": "^0.7.4"
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"vite": "^4.5.0"
},
"devDependenciesMeta": {
"@esbuild-plugins/node-globals-polyfill": "Necessary to run `tape` with browser-like `tape-run`.",
Expand Down
4 changes: 2 additions & 2 deletions packages/loaders/src/tiff/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import type { GeoTIFF, Pool } from 'geotiff';

import { createOffsetsProxy, checkProxies } from './lib/proxies';
import LZWDecoder from './lib/lzw-decoder';
import { parseFilename, OmeTiffSelection } from './lib/utils';
import { parseFilename, type OmeTiffSelection } from './lib/utils';

import { load as loadOme } from './ome-tiff';
import { load as loadMulti, MultiTiffImage } from './multi-tiff';
import { load as loadMulti, type MultiTiffImage } from './multi-tiff';

addDecoder(5, () => LZWDecoder);

Expand Down
4 changes: 3 additions & 1 deletion packages/loaders/src/tiff/lib/decoder.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import LZWDecoder from './lzw-decoder';

addDecoder(5, () => LZWDecoder);

const worker: Worker = self as any;
// @ts-expect-error - We are in a worker context
const worker: ServiceWorker = self;

worker.addEventListener('message', async e => {
// @ts-expect-error - FIXME: we should have strict types
const { id, fileDirectory, buffer } = e.data;
const decoder = await getDecoder(fileDirectory);
const decoded = await decoder.decode(fileDirectory, buffer);
Expand Down
9 changes: 5 additions & 4 deletions packages/loaders/src/tiff/lib/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const OFFSETS_PROXY_KEY = `${VIV_PROXY_KEY}-offsets` as const;
* and warn if missing.
*/
export function checkProxies(tiff: GeoTIFF) {
if (!isProxy(tiff, OFFSETS_PROXY_KEY)) {
if (!isProxy(tiff)) {
console.warn('GeoTIFF source is missing offsets proxy.');
}
}
Expand All @@ -18,8 +18,8 @@ export function checkProxies(tiff: GeoTIFF) {
* > tiff = createPoolProxy(tiff, new Pool());
* > isProxy(tiff, POOL_PROXY_KEY) === true; // true
*/
function isProxy(tiff: GeoTIFF, proxyFlag: string) {
return (tiff as any)[proxyFlag] as boolean;
function isProxy(tiff: GeoTIFF & { [VIV_PROXY_KEY]?: boolean }) {
return tiff[VIV_PROXY_KEY];
}

/*
Expand All @@ -33,7 +33,7 @@ function isProxy(tiff: GeoTIFF, proxyFlag: string) {
* rather than traversing the file system remotely.
*/
export function createOffsetsProxy(tiff: GeoTIFF, offsets: number[]) {
const get = (target: GeoTIFF, key: any) => {
const get = (target: GeoTIFF, key: unknown) => {
// Intercept `tiff.getImage`
if (key === 'getImage') {
return (index: number) => {
Expand All @@ -51,6 +51,7 @@ export function createOffsetsProxy(tiff: GeoTIFF, offsets: number[]) {
return true;
}

// @ts-expect-error Just forwarding the key
return Reflect.get(target, key);
};
return new Proxy(tiff, { get });
Expand Down
2 changes: 1 addition & 1 deletion packages/loaders/src/tiff/multi-tiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { guessTiffTileSize } from '../utils';
import {
getMultiTiffMetadata,
getMultiTiffMeta,
OmeTiffSelection
type OmeTiffSelection
} from './lib/utils';
import type Pool from './lib/Pool';
import { getMultiTiffIndexer } from './lib/indexers';
Expand Down
2 changes: 1 addition & 1 deletion packages/loaders/src/tiff/ome-tiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fromString } from '../omexml';

import TiffPixelSource from './pixel-source';
import { getOmeLegacyIndexer, getOmeSubIFDIndexer } from './lib/indexers';
import { getOmePixelSourceMeta, OmeTiffSelection } from './lib/utils';
import { getOmePixelSourceMeta, type OmeTiffSelection } from './lib/utils';
import { guessTiffTileSize } from '../utils';
import type Pool from './lib/Pool';
import type { OmeTiffIndexer } from './lib/indexers';
Expand Down
4 changes: 2 additions & 2 deletions packages/loaders/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ export function isInterleaved(shape: number[]) {
* > getLabels(imgMeta.Pixels) === ['t', 'z', 'c', 'y', 'x']
*/
type Sel<Dim extends string> =
Dim extends `${infer Z}${infer X}${infer A}${infer B}${infer C}`
Dim extends `${infer Z}${infer X}${infer A}${infer B}${infer C}` // eslint-disable-line @typescript-eslint/no-unused-vars
? [C, B, A]
: 'error';
: never;
export function getLabels(dimOrder: OMEXML[0]['Pixels']['DimensionOrder']) {
return dimOrder.toLowerCase().split('').reverse() as Labels<
Sel<Lowercase<typeof dimOrder>>
Expand Down
3 changes: 2 additions & 1 deletion packages/loaders/src/zarr/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export function guessBioformatsLabels(
const labels = getLabels(Pixels.DimensionOrder);
labels.forEach((lower, i) => {
const label = lower.toUpperCase();
const xmlSize = (Pixels as any)[`Size${label}`] as number;
// @ts-expect-error - FIXME: safer type access
const xmlSize: number = Pixels[`Size${label}`];
if (!xmlSize) {
throw Error(`Dimension ${label} is invalid for OME-XML.`);
}
Expand Down
1 change: 0 additions & 1 deletion packages/loaders/src/zarr/ome-zarr.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ZarrArray } from 'zarr';
import type { Labels } from '@vivjs/types';
import { loadMultiscales, guessTileSize } from './lib/utils';
import ZarrPixelSource from './pixel-source';

Expand Down
2 changes: 1 addition & 1 deletion packages/loaders/src/zarr/pixel-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class ZarrPixelSource<S extends string[]> implements PixelSource<S> {

private async _getRaw(
selection: (null | Slice | number)[],
getOptions?: { storeOptions?: any }
getOptions?: { storeOptions?: any } // eslint-disable-line @typescript-eslint/no-explicit-any
) {
const result = await this._data.getRaw(selection, getOptions);
if (typeof result !== 'object') {
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ type WithExtensionProps<LayerProps> = LayerProps extends { extensions: unknown }
LensExtensionProps &
ColorPalette3DExtensionProps &
AdditiveColormap3DExtensionProps
> & { [extensionProp: string]: any }
> & { [extensionProp: string]: any } // eslint-disable-line @typescript-eslint/no-explicit-any
: unknown;

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/views/src/VivView.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ export default class VivView {
* @returns {Layer} Instance of a layer.
*/
// eslint-disable-next-line class-methods-use-this,no-unused-vars
getLayers({ viewStates, props }) {}
getLayers({ viewStates, props }) {} // eslint-disable-line @typescript-eslint/no-unused-vars
}
Loading

0 comments on commit a16934d

Please sign in to comment.