1. 02 Nov, 2021 5 commits
    • Lyza Danger Gardner's avatar
      Rename `buttons` module -> `frontend-shared` · 7a3232ef
      Lyza Danger Gardner authored
      This makes the structure consistent with LMS' styles
      7a3232ef
    • Lyza Danger Gardner's avatar
    • Lyza Danger Gardner's avatar
      6fce0ccd
    • Lyza Danger Gardner's avatar
    • Robert Knight's avatar
      Simplify boot script build process · 627620da
      Robert Knight authored
      The boot script used to be generated in several stages:
      
       1. The files in `src/boot/` were bundled into `build/scripts/boot.bundle.js`
          with underscore-prefixed placeholders for certain data.
      
       2. A gulp task would generate `build/manifest.json` which included
          hashes of assets in the build dir
      
       3. Another gulp task would read `build/scripts/boot.bundle.js` and use
          string replacements to replace the placeholders with final values
          and write the result to `build/boot.js`
      
      This commit simplifies the process by combining stage (1) and (3). Add a
      separate Rollup config, rollup-boot.config.mjs, which builds
      `build/boot.js` directly from the `src/boot/index.js` entry point, using
      @rollup/plugin-replace to replace placeholders with data during the
      build.
      
      The code to generate the manifest in step (2) has been replaced with the
      manifest-generation code from the @hypothesis/frontend-build package,
      which is also shared with other projects.
      
      This change allows removal of several dependencies from the project, and
      means that we only have one way to replace `__PLACEHOLDER__`
      placeholders in JS files during the build, rather than two different
      ones.
      
      One minor change here is that only JS, CSS and sourcemap files are
      referenced in the manifest. Font files are not mentioned since the code
      that loads them (KaTeX) doesn't make use of the manifest.
      627620da
  2. 01 Nov, 2021 19 commits
  3. 28 Oct, 2021 4 commits
  4. 27 Oct, 2021 7 commits
    • Robert Knight's avatar
      Improve field name · 4102e483
      Robert Knight authored
      This is a count of the number of reconnections, not including the
      initial connection attempt.
      4102e483
    • Robert Knight's avatar
      Move WebSocket automatic reconnection to streamer service · d9a017a2
      Robert Knight authored
      Move the logic for automatically reconnecting to the WebSocket after an
      unexpected disconnection from the `Socket` WebSocket wrapper class to
      the `StreamerService` service. The Socket class is now responsible only
      for notifying the caller of unexpected disconnections.
      
      Letting StreamerService handle reconnection ensures that a fresh
      WebSocket URL, with a current access token, is used on each attempt. The
      previous approach would re-use the same URL on each attempt. This could
      lead to an obsolete access token being used, with the result that the
      WebSocket connection degraded to an unauthenticated one and not all
      expected updates were received.
      
      As part of this change, the logic for calculating the retry delay has been
      simplified and no longer uses the `retry` package, hopefully making the
      behavior easier to understand.
      d9a017a2
    • Robert Knight's avatar
      Remove obsolete JSX runtime aliases · 44310d04
      Robert Knight authored
      This is no longer needed with the current version of
      @hypothesis/frontend-shared.
      44310d04
    • Robert Knight's avatar
      Remove unused SASS bundling script · 037f2eb5
      Robert Knight authored
      This has been replaced by `buildCSS` from @hypothesis/frontend-build.
      037f2eb5
    • Robert Knight's avatar
      Update @hypothesis/frontend-shared to v4.0.0 · 8e2d612c
      Robert Knight authored
      This required a couple of changes to adapt to the removal of the
      CommonJS build. Some modules from the pattern library web app triggered
      a Babel warning about top-level `this`. I copied across the workaround
      from `rollup.config.js` in the @hypothesis/frontend-shared library.
      8e2d612c
    • Lyza Danger Gardner's avatar
      578a1cd8
    • Robert Knight's avatar
      Fix KaTeX font loading · e3384922
      Robert Knight authored
      When rendering math, the custom KaTex fonts failed to load due to the
      relative URL references in `build/styles/katex.min.css` not matching the
      actual location of the fonts in `build/fonts`. The KaTeX CSS assumes a
      URL structure like:
      
      ```
      katex.min.css
      fonts/
        KaTeX_AMS-Regular.woff2
      ```
      
      Previously font URLs in katex.min.css were rewritten from
      `url('fonts/foo.woff2')` to `url('../fonts/foo.woff2')` by a PostCSS
      plugin when building the CSS bundles. However this got lost when
      replacing the client's local style-bundling script with the one from the
      @hypothesis/frontend-shared package.
      
      By relocating the fonts to a subdirectory of `build/styles` we can make
      the asset references work without needing to do any rewriting of URLs in
      the KaTeX CSS bundle.
      
      In the process, the list of fonts included in the bundle was simplified
      to include just WOFF2 fonts, since all modern browsers support that
      format. Additionally an obsolete reference to fonts in src/styles/vendor
      was removed.
      e3384922
  5. 26 Oct, 2021 3 commits
  6. 25 Oct, 2021 2 commits