@internetarchive/collection-browser 4.1.2-alpha9 → 4.1.3-alpha-webdev8108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +11 -0
- package/.editorconfig +29 -29
- package/.github/workflows/ci.yml +27 -27
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +1 -1
- package/.prettierignore +1 -1
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/src/app-root.js +1 -4
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.js +30 -34
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +3 -2
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/models.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js +30 -29
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +6 -0
- package/dist/src/tiles/tile-dispatcher.js +224 -216
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +77 -77
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +126 -126
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +94 -80
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/dist/test/tiles/tile-display-value-provider.test.js.map +1 -1
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +120 -121
- package/renovate.json +6 -6
- package/src/app-root.ts +1 -4
- package/src/collection-browser.ts +41 -44
- package/src/data-source/collection-browser-data-source.ts +1445 -1444
- package/src/models.ts +874 -874
- package/src/tiles/hover/hover-pane-controller.ts +628 -627
- package/src/tiles/tile-dispatcher.ts +527 -518
- package/src/tiles/tile-display-value-provider.ts +124 -124
- package/test/mocks/mock-search-responses.ts +1364 -1364
- package/test/tiles/grid/item-tile.test.ts +520 -520
- package/test/tiles/list/tile-list.test.ts +552 -552
- package/test/tiles/tile-dispatcher.test.ts +300 -283
- package/test/tiles/tile-display-value-provider.test.ts +172 -172
- package/tsconfig.json +25 -25
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +52 -52
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
import { expect } from '@open-wc/testing';
|
|
2
|
-
import { nothing } from 'lit';
|
|
3
|
-
import { TileDisplayValueProvider } from '../../src/tiles/tile-display-value-provider';
|
|
4
|
-
import type { TileModel } from '../../src/models';
|
|
5
|
-
|
|
6
|
-
describe('Tile Display Value Provider', () => {
|
|
7
|
-
describe('basic construction', () => {
|
|
8
|
-
it('constructs w/ no options', () => {
|
|
9
|
-
const provider = new TileDisplayValueProvider();
|
|
10
|
-
expect(provider).to.exist;
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('constructs w/ options', () => {
|
|
14
|
-
const provider = new TileDisplayValueProvider({
|
|
15
|
-
model: {} as TileModel,
|
|
16
|
-
baseNavigationUrl: 'foo',
|
|
17
|
-
collectionPagePath: 'bar',
|
|
18
|
-
sortParam: { field: 'baz', direction: 'asc' },
|
|
19
|
-
creatorFilter: 'X',
|
|
20
|
-
});
|
|
21
|
-
expect(provider).to.exist;
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('firstCreatorMatchingFilter', () => {
|
|
26
|
-
it('provides undefined creator when no model set', () => {
|
|
27
|
-
const provider = new TileDisplayValueProvider();
|
|
28
|
-
expect(provider.firstCreatorMatchingFilter).to.be.undefined;
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('provides creator from model with no filter', () => {
|
|
32
|
-
const provider = new TileDisplayValueProvider({
|
|
33
|
-
model: { creator: 'foo', creators: ['foo', 'bar', 'baz'] } as TileModel,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
expect(provider.firstCreatorMatchingFilter).to.equal('foo');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('provides first creator matching filter when present', () => {
|
|
40
|
-
const provider = new TileDisplayValueProvider({
|
|
41
|
-
model: { creator: 'foo', creators: ['foo', 'bar', 'baz'] } as TileModel,
|
|
42
|
-
creatorFilter: 'B',
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
expect(provider.firstCreatorMatchingFilter).to.equal('bar');
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('matches letters with diacritics', () => {
|
|
49
|
-
const provider = new TileDisplayValueProvider({
|
|
50
|
-
model: {
|
|
51
|
-
creator: 'foo',
|
|
52
|
-
creators: ['foo', 'émile', 'ernest'],
|
|
53
|
-
} as TileModel,
|
|
54
|
-
creatorFilter: 'E',
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
expect(provider.firstCreatorMatchingFilter).to.equal('émile');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('ignores non-alphabetical characters when matching', () => {
|
|
61
|
-
const provider = new TileDisplayValueProvider({
|
|
62
|
-
model: {
|
|
63
|
-
creator: 'foo',
|
|
64
|
-
creators: ['foo', '"(bar)"', 'baz'],
|
|
65
|
-
} as TileModel,
|
|
66
|
-
creatorFilter: 'B',
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
expect(provider.firstCreatorMatchingFilter).to.equal('"(bar)"');
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
describe('accountLabel', () => {
|
|
74
|
-
it('provides empty account label when no model', () => {
|
|
75
|
-
const provider = new TileDisplayValueProvider();
|
|
76
|
-
expect(provider.accountLabel).to.equal('');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('provides empty account label when no date added', () => {
|
|
80
|
-
const provider = new TileDisplayValueProvider({ model: {} as TileModel });
|
|
81
|
-
expect(provider.accountLabel).to.equal('');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('provides Archivist label from date added', () => {
|
|
85
|
-
const provider = new TileDisplayValueProvider({
|
|
86
|
-
model: { dateAdded: new Date(2010, 1, 2) } as TileModel,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
expect(provider.accountLabel).to.equal('Archivist since 2010');
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
describe('dateLabel', () => {
|
|
94
|
-
it('provides empty date label when no sort param', () => {
|
|
95
|
-
const provider = new TileDisplayValueProvider();
|
|
96
|
-
expect(provider.dateLabel).to.equal('');
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('provides empty date label when sorting by non-date', () => {
|
|
100
|
-
const provider = new TileDisplayValueProvider({
|
|
101
|
-
sortParam: { field: 'downloads', direction: 'desc' },
|
|
102
|
-
});
|
|
103
|
-
expect(provider.dateLabel).to.equal('');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('provides correct date label for publicdate', () => {
|
|
107
|
-
const provider = new TileDisplayValueProvider({
|
|
108
|
-
sortParam: { field: 'publicdate', direction: 'asc' },
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
expect(provider.dateLabel).to.equal('Archived');
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('provides correct date label for reviewdate', () => {
|
|
115
|
-
const provider = new TileDisplayValueProvider({
|
|
116
|
-
sortParam: { field: 'reviewdate', direction: 'asc' },
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
expect(provider.dateLabel).to.equal('Reviewed');
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('provides correct date label for addeddate', () => {
|
|
123
|
-
const provider = new TileDisplayValueProvider({
|
|
124
|
-
sortParam: { field: 'addeddate', direction: 'asc' },
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
expect(provider.dateLabel).to.equal('Added');
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('provides correct date label for published date', () => {
|
|
131
|
-
const provider = new TileDisplayValueProvider({
|
|
132
|
-
sortParam: { field: 'date', direction: 'asc' },
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
expect(provider.dateLabel).to.equal('Published');
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
describe('itemPageUrl', () => {
|
|
140
|
-
it('provides nothing when no base url set', () => {
|
|
141
|
-
const provider = new TileDisplayValueProvider();
|
|
142
|
-
expect(provider.itemPageUrl('foo')).to.equal(nothing);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('provides nothing when identifier is empty', () => {
|
|
146
|
-
const provider = new TileDisplayValueProvider({
|
|
147
|
-
baseNavigationUrl: 'foo',
|
|
148
|
-
});
|
|
149
|
-
expect(provider.itemPageUrl('')).to.equal(nothing);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('builds correct url from base and identifier', () => {
|
|
153
|
-
const provider = new TileDisplayValueProvider({
|
|
154
|
-
baseNavigationUrl: 'base',
|
|
155
|
-
});
|
|
156
|
-
expect(provider.itemPageUrl('foo')).to.equal('base/details/foo');
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('allows base url to be empty', () => {
|
|
160
|
-
const provider = new TileDisplayValueProvider({ baseNavigationUrl: '' });
|
|
161
|
-
expect(provider.itemPageUrl('foo')).to.equal('/details/foo');
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it('uses provided collection base path for collections', () => {
|
|
165
|
-
const provider = new TileDisplayValueProvider({
|
|
166
|
-
baseNavigationUrl: 'base',
|
|
167
|
-
collectionPagePath: '/collection/',
|
|
168
|
-
});
|
|
169
|
-
expect(provider.itemPageUrl('foo', true)).to.equal('base/collection/foo');
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
});
|
|
1
|
+
import { expect } from '@open-wc/testing';
|
|
2
|
+
import { nothing } from 'lit';
|
|
3
|
+
import { TileDisplayValueProvider } from '../../src/tiles/tile-display-value-provider';
|
|
4
|
+
import type { TileModel } from '../../src/models';
|
|
5
|
+
|
|
6
|
+
describe('Tile Display Value Provider', () => {
|
|
7
|
+
describe('basic construction', () => {
|
|
8
|
+
it('constructs w/ no options', () => {
|
|
9
|
+
const provider = new TileDisplayValueProvider();
|
|
10
|
+
expect(provider).to.exist;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('constructs w/ options', () => {
|
|
14
|
+
const provider = new TileDisplayValueProvider({
|
|
15
|
+
model: {} as TileModel,
|
|
16
|
+
baseNavigationUrl: 'foo',
|
|
17
|
+
collectionPagePath: 'bar',
|
|
18
|
+
sortParam: { field: 'baz', direction: 'asc' },
|
|
19
|
+
creatorFilter: 'X',
|
|
20
|
+
});
|
|
21
|
+
expect(provider).to.exist;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('firstCreatorMatchingFilter', () => {
|
|
26
|
+
it('provides undefined creator when no model set', () => {
|
|
27
|
+
const provider = new TileDisplayValueProvider();
|
|
28
|
+
expect(provider.firstCreatorMatchingFilter).to.be.undefined;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('provides creator from model with no filter', () => {
|
|
32
|
+
const provider = new TileDisplayValueProvider({
|
|
33
|
+
model: { creator: 'foo', creators: ['foo', 'bar', 'baz'] } as TileModel,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
expect(provider.firstCreatorMatchingFilter).to.equal('foo');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('provides first creator matching filter when present', () => {
|
|
40
|
+
const provider = new TileDisplayValueProvider({
|
|
41
|
+
model: { creator: 'foo', creators: ['foo', 'bar', 'baz'] } as TileModel,
|
|
42
|
+
creatorFilter: 'B',
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
expect(provider.firstCreatorMatchingFilter).to.equal('bar');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('matches letters with diacritics', () => {
|
|
49
|
+
const provider = new TileDisplayValueProvider({
|
|
50
|
+
model: {
|
|
51
|
+
creator: 'foo',
|
|
52
|
+
creators: ['foo', 'émile', 'ernest'],
|
|
53
|
+
} as TileModel,
|
|
54
|
+
creatorFilter: 'E',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
expect(provider.firstCreatorMatchingFilter).to.equal('émile');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('ignores non-alphabetical characters when matching', () => {
|
|
61
|
+
const provider = new TileDisplayValueProvider({
|
|
62
|
+
model: {
|
|
63
|
+
creator: 'foo',
|
|
64
|
+
creators: ['foo', '"(bar)"', 'baz'],
|
|
65
|
+
} as TileModel,
|
|
66
|
+
creatorFilter: 'B',
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
expect(provider.firstCreatorMatchingFilter).to.equal('"(bar)"');
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('accountLabel', () => {
|
|
74
|
+
it('provides empty account label when no model', () => {
|
|
75
|
+
const provider = new TileDisplayValueProvider();
|
|
76
|
+
expect(provider.accountLabel).to.equal('');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('provides empty account label when no date added', () => {
|
|
80
|
+
const provider = new TileDisplayValueProvider({ model: {} as TileModel });
|
|
81
|
+
expect(provider.accountLabel).to.equal('');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('provides Archivist label from date added', () => {
|
|
85
|
+
const provider = new TileDisplayValueProvider({
|
|
86
|
+
model: { dateAdded: new Date(2010, 1, 2) } as TileModel,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
expect(provider.accountLabel).to.equal('Archivist since 2010');
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe('dateLabel', () => {
|
|
94
|
+
it('provides empty date label when no sort param', () => {
|
|
95
|
+
const provider = new TileDisplayValueProvider();
|
|
96
|
+
expect(provider.dateLabel).to.equal('');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('provides empty date label when sorting by non-date', () => {
|
|
100
|
+
const provider = new TileDisplayValueProvider({
|
|
101
|
+
sortParam: { field: 'downloads', direction: 'desc' },
|
|
102
|
+
});
|
|
103
|
+
expect(provider.dateLabel).to.equal('');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('provides correct date label for publicdate', () => {
|
|
107
|
+
const provider = new TileDisplayValueProvider({
|
|
108
|
+
sortParam: { field: 'publicdate', direction: 'asc' },
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
expect(provider.dateLabel).to.equal('Archived');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('provides correct date label for reviewdate', () => {
|
|
115
|
+
const provider = new TileDisplayValueProvider({
|
|
116
|
+
sortParam: { field: 'reviewdate', direction: 'asc' },
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
expect(provider.dateLabel).to.equal('Reviewed');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('provides correct date label for addeddate', () => {
|
|
123
|
+
const provider = new TileDisplayValueProvider({
|
|
124
|
+
sortParam: { field: 'addeddate', direction: 'asc' },
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
expect(provider.dateLabel).to.equal('Added');
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('provides correct date label for published date', () => {
|
|
131
|
+
const provider = new TileDisplayValueProvider({
|
|
132
|
+
sortParam: { field: 'date', direction: 'asc' },
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
expect(provider.dateLabel).to.equal('Published');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
describe('itemPageUrl', () => {
|
|
140
|
+
it('provides nothing when no base url set', () => {
|
|
141
|
+
const provider = new TileDisplayValueProvider();
|
|
142
|
+
expect(provider.itemPageUrl('foo')).to.equal(nothing);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('provides nothing when identifier is empty', () => {
|
|
146
|
+
const provider = new TileDisplayValueProvider({
|
|
147
|
+
baseNavigationUrl: 'foo',
|
|
148
|
+
});
|
|
149
|
+
expect(provider.itemPageUrl('')).to.equal(nothing);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('builds correct url from base and identifier', () => {
|
|
153
|
+
const provider = new TileDisplayValueProvider({
|
|
154
|
+
baseNavigationUrl: 'base',
|
|
155
|
+
});
|
|
156
|
+
expect(provider.itemPageUrl('foo')).to.equal('base/details/foo');
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('allows base url to be empty', () => {
|
|
160
|
+
const provider = new TileDisplayValueProvider({ baseNavigationUrl: '' });
|
|
161
|
+
expect(provider.itemPageUrl('foo')).to.equal('/details/foo');
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('uses provided collection base path for collections', () => {
|
|
165
|
+
const provider = new TileDisplayValueProvider({
|
|
166
|
+
baseNavigationUrl: 'base',
|
|
167
|
+
collectionPagePath: '/collection/',
|
|
168
|
+
});
|
|
169
|
+
expect(provider.itemPageUrl('foo', true)).to.equal('base/collection/foo');
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"noEmitOnError": true,
|
|
7
|
-
"lib": [
|
|
8
|
-
"ESNext",
|
|
9
|
-
"dom",
|
|
10
|
-
"dom.iterable"
|
|
11
|
-
],
|
|
12
|
-
"strict": true,
|
|
13
|
-
"esModuleInterop": false,
|
|
14
|
-
"allowSyntheticDefaultImports": true,
|
|
15
|
-
"experimentalDecorators": true,
|
|
16
|
-
"importHelpers": true,
|
|
17
|
-
"outDir": "dist",
|
|
18
|
-
"sourceMap": true,
|
|
19
|
-
"inlineSources": true,
|
|
20
|
-
"rootDir": "./",
|
|
21
|
-
"declaration": true,
|
|
22
|
-
"useDefineForClassFields": false,
|
|
23
|
-
},
|
|
24
|
-
"include": ["src", "test", "index.ts", "types"],
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"noEmitOnError": true,
|
|
7
|
+
"lib": [
|
|
8
|
+
"ESNext",
|
|
9
|
+
"dom",
|
|
10
|
+
"dom.iterable"
|
|
11
|
+
],
|
|
12
|
+
"strict": true,
|
|
13
|
+
"esModuleInterop": false,
|
|
14
|
+
"allowSyntheticDefaultImports": true,
|
|
15
|
+
"experimentalDecorators": true,
|
|
16
|
+
"importHelpers": true,
|
|
17
|
+
"outDir": "dist",
|
|
18
|
+
"sourceMap": true,
|
|
19
|
+
"inlineSources": true,
|
|
20
|
+
"rootDir": "./",
|
|
21
|
+
"declaration": true,
|
|
22
|
+
"useDefineForClassFields": false,
|
|
23
|
+
},
|
|
24
|
+
"include": ["src", "test", "index.ts", "types"],
|
|
25
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
-
|
|
3
|
-
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
-
const hmr = process.argv.includes('--hmr');
|
|
5
|
-
|
|
6
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
-
nodeResolve: true,
|
|
8
|
-
open: '/',
|
|
9
|
-
watch: !hmr,
|
|
10
|
-
|
|
11
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
12
|
-
// esbuildTarget: 'auto'
|
|
13
|
-
|
|
14
|
-
/** Set appIndex to enable SPA routing */
|
|
15
|
-
// appIndex: 'demo/index.html',
|
|
16
|
-
|
|
17
|
-
/** Confgure bare import resolve plugin */
|
|
18
|
-
// nodeResolve: {
|
|
19
|
-
// exportConditions: ['browser', 'development']
|
|
20
|
-
// },
|
|
21
|
-
|
|
22
|
-
plugins: [
|
|
23
|
-
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
24
|
-
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
25
|
-
],
|
|
26
|
-
|
|
27
|
-
http2: true,
|
|
28
|
-
sslCert: './local.archive.org.cert',
|
|
29
|
-
sslKey: './local.archive.org.key',
|
|
30
|
-
});
|
|
1
|
+
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
+
|
|
3
|
+
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
+
const hmr = process.argv.includes('--hmr');
|
|
5
|
+
|
|
6
|
+
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
+
nodeResolve: true,
|
|
8
|
+
open: '/',
|
|
9
|
+
watch: !hmr,
|
|
10
|
+
|
|
11
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
12
|
+
// esbuildTarget: 'auto'
|
|
13
|
+
|
|
14
|
+
/** Set appIndex to enable SPA routing */
|
|
15
|
+
// appIndex: 'demo/index.html',
|
|
16
|
+
|
|
17
|
+
/** Confgure bare import resolve plugin */
|
|
18
|
+
// nodeResolve: {
|
|
19
|
+
// exportConditions: ['browser', 'development']
|
|
20
|
+
// },
|
|
21
|
+
|
|
22
|
+
plugins: [
|
|
23
|
+
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
24
|
+
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
http2: true,
|
|
28
|
+
sslCert: './local.archive.org.cert',
|
|
29
|
+
sslKey: './local.archive.org.key',
|
|
30
|
+
});
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import rollupImage from '@rollup/plugin-image';
|
|
2
|
-
import { rollupAdapter } from '@web/dev-server-rollup';
|
|
3
|
-
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
4
|
-
|
|
5
|
-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
6
|
-
|
|
7
|
-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
8
|
-
/** Test files to run */
|
|
9
|
-
files: 'dist/test/**/*.test.js',
|
|
10
|
-
|
|
11
|
-
/** Resolve bare module imports */
|
|
12
|
-
nodeResolve: {
|
|
13
|
-
exportConditions: ['browser', 'development'],
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
mimeTypes: {
|
|
17
|
-
'**/*.scss': 'js',
|
|
18
|
-
'**/*.css': 'js',
|
|
19
|
-
'**/*.svg': 'js',
|
|
20
|
-
'**/*.json': 'js',
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
/** Filter out lit dev mode logs */
|
|
24
|
-
filterBrowserLogs(log) {
|
|
25
|
-
for (const arg of log.args) {
|
|
26
|
-
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
plugins: [rollupAdapter(rollupImage())],
|
|
34
|
-
|
|
35
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
36
|
-
// esbuildTarget: 'auto',
|
|
37
|
-
|
|
38
|
-
/** Amount of browsers to run concurrently */
|
|
39
|
-
// concurrentBrowsers: 2,
|
|
40
|
-
|
|
41
|
-
/** Amount of test files per browser to test concurrently */
|
|
42
|
-
// concurrency: 1,
|
|
43
|
-
|
|
44
|
-
/** Browsers to run tests on */
|
|
45
|
-
// browsers: [
|
|
46
|
-
// playwrightLauncher({ product: 'chromium' }),
|
|
47
|
-
// playwrightLauncher({ product: 'firefox' }),
|
|
48
|
-
// playwrightLauncher({ product: 'webkit' }),
|
|
49
|
-
// ],
|
|
50
|
-
|
|
51
|
-
// See documentation for all available options
|
|
52
|
-
});
|
|
1
|
+
import rollupImage from '@rollup/plugin-image';
|
|
2
|
+
import { rollupAdapter } from '@web/dev-server-rollup';
|
|
3
|
+
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
4
|
+
|
|
5
|
+
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
6
|
+
|
|
7
|
+
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
8
|
+
/** Test files to run */
|
|
9
|
+
files: 'dist/test/**/*.test.js',
|
|
10
|
+
|
|
11
|
+
/** Resolve bare module imports */
|
|
12
|
+
nodeResolve: {
|
|
13
|
+
exportConditions: ['browser', 'development'],
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
mimeTypes: {
|
|
17
|
+
'**/*.scss': 'js',
|
|
18
|
+
'**/*.css': 'js',
|
|
19
|
+
'**/*.svg': 'js',
|
|
20
|
+
'**/*.json': 'js',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
/** Filter out lit dev mode logs */
|
|
24
|
+
filterBrowserLogs(log) {
|
|
25
|
+
for (const arg of log.args) {
|
|
26
|
+
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
plugins: [rollupAdapter(rollupImage())],
|
|
34
|
+
|
|
35
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
36
|
+
// esbuildTarget: 'auto',
|
|
37
|
+
|
|
38
|
+
/** Amount of browsers to run concurrently */
|
|
39
|
+
// concurrentBrowsers: 2,
|
|
40
|
+
|
|
41
|
+
/** Amount of test files per browser to test concurrently */
|
|
42
|
+
// concurrency: 1,
|
|
43
|
+
|
|
44
|
+
/** Browsers to run tests on */
|
|
45
|
+
// browsers: [
|
|
46
|
+
// playwrightLauncher({ product: 'chromium' }),
|
|
47
|
+
// playwrightLauncher({ product: 'firefox' }),
|
|
48
|
+
// playwrightLauncher({ product: 'webkit' }),
|
|
49
|
+
// ],
|
|
50
|
+
|
|
51
|
+
// See documentation for all available options
|
|
52
|
+
});
|