Skip to content

Commit 88a3c4d

Browse files
authored
Merge pull request #23 from atlas-viewer/feature/v2.2
PNPM, Vitest, tsup
2 parents 0d4b5e8 + 01012d2 commit 88a3c4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2270
-4416
lines changed

.codesandbox/ci.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"sandboxes": ["new", "vanilla"],
3-
"node": "16"
3+
"node": "18"
44
}

.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
node: ['18', '20']
11+
12+
name: Node ${{ matrix.node }} build
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Setup node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: ${{ matrix.node }}
19+
20+
- uses: pnpm/action-setup@v3
21+
with:
22+
version: 8
23+
run_install: |
24+
- recursive: true
25+
args: [--frozen-lockfile, --strict-peer-dependencies]
26+
27+
- run: pnpm run build
28+
- run: pnpm run test
29+
- run: pnpm run lint
30+
- run: pnpm run typecheck
31+
- run: node pkg-tests/node-load.cjs
32+
- run: node pkg-tests/node-load.mjs

.github/workflows/yarn.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.idea/fesk-ts.iml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.idea/jsLibraryMappings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/misc.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12
1+
18

.prettierrc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
{
22
"printWidth": 120,
3-
"tabWidth": 2,
4-
"useTabs": false,
5-
"semi": true,
6-
"singleQuote": true,
73
"trailingComma": "es5",
8-
"bracketSpacing": true,
9-
"jsxBracketSameLine": false,
10-
"fluid": false
4+
"singleQuote": true
115
}

__tests__/get-image-services.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import { describe, expect, test } from 'vitest';
2+
13
import { getImageServices } from '../src';
24

35
describe('getImageServices', () => {
46
test('It can work when a resource has no height/width', () => {
57
expect(
68
getImageServices({
7-
id:
8-
'https://api.bl.uk/image/iiif/ark:/81055/vdc_100113995491.0x000001/full/max/0/default.jpg',
9+
id: 'https://api.bl.uk/image/iiif/ark:/81055/vdc_100113995491.0x000001/full/max/0/default.jpg',
910
type: 'Image',
1011
format: 'image/jpg',
1112
service: [
@@ -19,8 +20,7 @@ describe('getImageServices', () => {
1920
width: 256,
2021
},
2122
],
22-
id:
23-
'https://api.bl.uk/image/iiif/ark:/81055/vdc_100113995491.0x000001',
23+
id: 'https://api.bl.uk/image/iiif/ark:/81055/vdc_100113995491.0x000001',
2424
type: 'ImageService2',
2525
profile: 'level2',
2626
},

__tests__/image-service-loader.test.ts

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, expect, test } from 'vitest';
12
import { ImageServiceLoader } from '../src/image-service-loader';
23
import { Service } from '../src/types';
34
import { ImageService } from '@iiif/presentation-3';
@@ -105,8 +106,8 @@ describe('image service loader', () => {
105106

106107
expect(Object.keys(loader.knownImageServers)).toEqual(['damsssl.llgc.org.uk']);
107108

108-
expect(loader.knownImageServers['damsssl.llgc.org.uk'].verified).toEqual(false);
109-
expect(loader.knownImageServers['damsssl.llgc.org.uk'].sampledId).toEqual(
109+
expect(loader.knownImageServers['damsssl.llgc.org.uk']!.verified).toEqual(false);
110+
expect(loader.knownImageServers['damsssl.llgc.org.uk']!.sampledId).toEqual(
110111
'https://damsssl.llgc.org.uk/iiif/2.0/image/4694557'
111112
);
112113
});
@@ -136,7 +137,7 @@ describe('image service loader', () => {
136137
).not.toEqual(null);
137138

138139
expect(Object.keys(loader.knownImageServers)).toEqual(['damsssl.llgc.org.uk']);
139-
expect(loader.knownImageServers['damsssl.llgc.org.uk'].verified).toEqual(true);
140+
expect(loader.knownImageServers['damsssl.llgc.org.uk']!.verified).toEqual(true);
140141
});
141142

142143
test('it wont predict if there is not enough verifications', async () => {
@@ -169,7 +170,7 @@ describe('image service loader', () => {
169170
})
170171
).not.toEqual(null);
171172

172-
expect(loader.knownImageServers['damsssl.llgc.org.uk'].verifications).toEqual(1);
173+
expect(loader.knownImageServers['damsssl.llgc.org.uk']!.verifications).toEqual(1);
173174
});
174175
});
175176

@@ -332,53 +333,53 @@ describe('image service loader', () => {
332333
expect(image3Prediction.sizes).toEqual(image3.sizes);
333334

334335
expect(Object.keys(loader.knownImageServers)).toEqual(['iiif.bodleian.ox.ac.uk']);
335-
expect(loader.knownImageServers['iiif.bodleian.ox.ac.uk'].verified).toEqual(true);
336+
expect(loader.knownImageServers['iiif.bodleian.ox.ac.uk']!.verified).toEqual(true);
336337
});
337338
});
338339

339-
describe('sbb', () => {
340-
const sbbInfo = {
341-
'@context': 'http://iiif.io/api/image/2/context.json',
342-
'@id': 'https://iiif-content.crossasia.org/xasia/dllm+dllm_0005978+233695',
343-
'@type': 'iiif:Image',
344-
protocol: 'http://iiif.io/api/image',
345-
width: 1741,
346-
height: 2381,
347-
sizes: [
348-
{ width: 150, height: 100 },
349-
{
350-
width: 600,
351-
height: 400,
352-
},
353-
{ width: 2400, height: 4000 },
354-
{ width: 1722, height: 2304 },
355-
],
356-
tiles: [
357-
{ width: 256, scaleFactors: [1] },
358-
{
359-
width: 512,
360-
scaleFactors: [2, 4],
361-
},
362-
{ width: 1024, scaleFactors: [8, 16] },
363-
],
364-
logo: {
365-
'@id': 'https://iiif-content.crossasia.org/xasia/logo',
366-
service: {
367-
'@context': 'http://iiif.io/api/image/2/context.json',
368-
'@id': 'https://iiif-content.crossasia.org/xasia/logo',
369-
profile: 'http://iiif.io/api/image/2/level2.json',
370-
},
371-
},
372-
profile: [
373-
'http://iiif.io/api/image/2/level2.json',
374-
{
375-
formats: ['jpg', 'png', 'webp', 'tif'],
376-
qualities: ['color', 'gray'],
377-
supports: ['canonicalLinkHeader', 'rotationArbitrary', 'profileLinkHeader'],
378-
},
379-
],
380-
};
381-
});
340+
// describe('sbb', () => {
341+
// const sbbInfo = {
342+
// '@context': 'http://iiif.io/api/image/2/context.json',
343+
// '@id': 'https://iiif-content.crossasia.org/xasia/dllm+dllm_0005978+233695',
344+
// '@type': 'iiif:Image',
345+
// protocol: 'http://iiif.io/api/image',
346+
// width: 1741,
347+
// height: 2381,
348+
// sizes: [
349+
// { width: 150, height: 100 },
350+
// {
351+
// width: 600,
352+
// height: 400,
353+
// },
354+
// { width: 2400, height: 4000 },
355+
// { width: 1722, height: 2304 },
356+
// ],
357+
// tiles: [
358+
// { width: 256, scaleFactors: [1] },
359+
// {
360+
// width: 512,
361+
// scaleFactors: [2, 4],
362+
// },
363+
// { width: 1024, scaleFactors: [8, 16] },
364+
// ],
365+
// logo: {
366+
// '@id': 'https://iiif-content.crossasia.org/xasia/logo',
367+
// service: {
368+
// '@context': 'http://iiif.io/api/image/2/context.json',
369+
// '@id': 'https://iiif-content.crossasia.org/xasia/logo',
370+
// profile: 'http://iiif.io/api/image/2/level2.json',
371+
// },
372+
// },
373+
// profile: [
374+
// 'http://iiif.io/api/image/2/level2.json',
375+
// {
376+
// formats: ['jpg', 'png', 'webp', 'tif'],
377+
// qualities: ['color', 'gray'],
378+
// supports: ['canonicalLinkHeader', 'rotationArbitrary', 'profileLinkHeader'],
379+
// },
380+
// ],
381+
// };
382+
// });
382383

383384
describe('getty quire example (level0)', () => {
384385
const infoA = {
@@ -452,13 +453,13 @@ describe('image service loader', () => {
452453
await loader.sample(infoB as any);
453454
// await loader.sample();
454455

455-
const prediection = loader.predict({
456+
const prediction = loader.predict({
456457
id: infoC['@id'],
457458
width: infoC.width as number,
458459
height: infoC.height as number,
459460
}) as Service;
460461

461-
expect(prediection).toEqual(null);
462+
expect(prediction).toEqual(null);
462463
});
463464
test('C -> B -> A', async () => {
464465
const loader = new ImageServiceLoader({ approximateServices: true });
@@ -468,13 +469,13 @@ describe('image service loader', () => {
468469
await loader.sample(infoB as any);
469470
// await loader.sample();
470471

471-
const prediection = loader.predict({
472+
const prediction = loader.predict({
472473
id: infoA['@id'],
473474
width: infoA.width as number,
474475
height: infoA.height as number,
475476
}) as Service;
476477

477-
expect(prediection).toEqual(null);
478+
expect(prediction).toEqual(null);
478479
});
479480
test('A -> C -> B', async () => {
480481
const loader = new ImageServiceLoader({ approximateServices: true });
@@ -484,13 +485,13 @@ describe('image service loader', () => {
484485
await loader.sample(infoC as any);
485486
// await loader.sample();
486487

487-
const prediection = loader.predict({
488+
const prediction = loader.predict({
488489
id: infoB['@id'],
489490
width: infoB.width as number,
490491
height: infoB.height as number,
491492
}) as Service;
492493

493-
expect(prediection).toEqual(null);
494+
expect(prediction).toEqual(null);
494495
});
495496
});
496497
});

0 commit comments

Comments
 (0)