@internetarchive/bookreader 5.0.0-57 → 5.0.0-58

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 5.0.0-58
2
+ - Fix BookReader sometimes failing to load when starting in Mode1Up @cdrini
3
+ - Update testing dependencies @cdrini
4
+
1
5
  # 5.0.0-57
2
6
  - Fix - do not show Download pane when there aren't any available @iisa
3
7
 
package/babel.config.js CHANGED
@@ -2,8 +2,11 @@ module.exports = {
2
2
  presets: [
3
3
  [
4
4
  "@babel/preset-env",
5
- process.env.NODE_ENV == 'test' ? { targets: {esmodules: true} } : {
6
- targets: "> 2%, ie 11, edge 14, samsung > 9, OperaMini all, UCAndroid > 12, Safari >= 9",
5
+ {
6
+ targets: (
7
+ process.env.NODE_ENV == 'test' ? {node: process.version} :
8
+ "> 2%, ie 11, edge 14, samsung > 9, OperaMini all, UCAndroid > 12, Safari >= 9"
9
+ ),
7
10
  useBuiltIns: "usage",
8
11
  corejs: 3
9
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/bookreader",
3
- "version": "5.0.0-57",
3
+ "version": "5.0.0-58",
4
4
  "description": "The Internet Archive BookReader.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,12 +42,12 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@babel/core": "7.17.9",
45
- "@babel/eslint-parser": "7.17.0",
45
+ "@babel/eslint-parser": "7.21.3",
46
46
  "@babel/plugin-proposal-class-properties": "7.16.7",
47
47
  "@babel/plugin-proposal-decorators": "7.17.9",
48
48
  "@babel/preset-env": "7.16.11",
49
- "@open-wc/testing-helpers": "^2.1.4",
50
- "@types/jest": "^29.4.0",
49
+ "@open-wc/testing-helpers": "^2.2.0",
50
+ "@types/jest": "^29.5.0",
51
51
  "@webcomponents/webcomponentsjs": "^2.6.0",
52
52
  "babel-loader": "8.2.5",
53
53
  "codecov": "^3.8.3",
@@ -60,7 +60,7 @@
60
60
  "hammerjs": "^2.0.8",
61
61
  "http-server": "14.1.1",
62
62
  "iso-language-codes": "1.1.0",
63
- "jest": "^29.4.3",
63
+ "jest": "29.5.0",
64
64
  "jest-environment-jsdom": "^29.4.3",
65
65
  "jquery": "3.6.1",
66
66
  "jquery-colorbox": "1.6.4",
@@ -72,10 +72,10 @@
72
72
  "node-fetch": "3.2.10",
73
73
  "regenerator-runtime": "0.13.9",
74
74
  "sass": "1.52.1",
75
- "sinon": "^15.0.1",
75
+ "sinon": "15.0.3",
76
76
  "soundmanager2": "2.97.20170602",
77
77
  "svgo": "2.8.0",
78
- "testcafe": "^2.0.1",
78
+ "testcafe": "2.4.0",
79
79
  "testcafe-browser-provider-browserstack": "^1.13.2-alpha.1",
80
80
  "webpack": "5.51.1",
81
81
  "webpack-cli": "4.9.2"
@@ -89,7 +89,8 @@
89
89
  "^@/(.*)$": "<rootDir>/$1"
90
90
  },
91
91
  "setupFiles": [
92
- "./src/jquery-wrapper.js"
92
+ "./src/jquery-wrapper.js",
93
+ "./tests/jest/setup.js"
93
94
  ],
94
95
  "roots": [
95
96
  "<rootDir>/src/",
@@ -118,7 +119,7 @@
118
119
  "test:e2e": "npm run build && npx testcafe",
119
120
  "test:e2e:dev": "npx testcafe --live --dev",
120
121
  "DOCS:update:test-deps": "If CI succeeds, these should be good to update",
121
- "update:test-deps": "npm i @babel/eslint-parser@latest @open-wc/testing-helpers@latest @types/jest@latest codecov@latest eslint@latest eslint-plugin-testcafe@latest jest@latest sinon@latest testcafe@latest",
122
+ "update:test-deps": "npm i @babel/eslint-parser@latest @open-wc/testing-helpers@latest @types/jest@latest codecov@latest eslint@7 eslint-plugin-testcafe@latest jest@latest sinon@latest testcafe@latest",
122
123
  "DOCS:update:build-deps": "These can cause strange changes, so do an npm run build + check file size (git diff --stat), and check the site is as expected",
123
124
  "update:build-deps": "npm i @babel/core@latest @babel/preset-env@latest babel-loader@latest core-js@latest regenerator-runtime@latest sass@latest svgo@latest webpack@latest webpack-cli@latest",
124
125
  "codecov": "npx codecov"
@@ -58,6 +58,11 @@ export class Mode1Up {
58
58
  });
59
59
  }
60
60
  this.mode1UpLit.jumpToIndex(startLeaf);
61
+ setTimeout(() => {
62
+ // Must explicitly call updateVisibleRegion, since no
63
+ // scroll event seems to fire.
64
+ this.mode1UpLit.updateVisibleRegion();
65
+ });
61
66
  });
62
67
  this.br.updateBrClasses();
63
68
  }
@@ -203,9 +203,12 @@ export class Mode1UpLit extends LitElement {
203
203
  }
204
204
  if (changedProps.has('visiblePages')) {
205
205
  this.throttledUpdateRenderedPages();
206
- this.br.displayedIndices = this.visiblePages.map(p => p.index);
207
- this.br.updateFirstIndex(this.br.displayedIndices[0]);
208
- this.br._components.navbar.updateNavIndexThrottled();
206
+ if (this.visiblePages.length) {
207
+ // unclear why this is ever really happening
208
+ this.br.displayedIndices = this.visiblePages.map(p => p.index);
209
+ this.br.updateFirstIndex(this.br.displayedIndices[0]);
210
+ this.br._components.navbar.updateNavIndexThrottled();
211
+ }
209
212
  }
210
213
  if (changedProps.has('scale')) {
211
214
  const oldVal = changedProps.get('scale');
@@ -0,0 +1,3 @@
1
+ process.on("unhandledRejection", (error) => {
2
+ throw error;
3
+ });