Skip to content

0.0.22

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 28 Feb 00:34

Installation

Copy the following into your WORKSPACE.bazel file:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "aspect_rules_js",
    sha256 = "3ad6684d744ebbc6592d404cc3aa81d0da634eccb3499f6fd198ae122fa28489",
    strip_prefix = "rules_js-1.19.0",
    url = "https://github.com/aspect-build/rules_js/releases/download/v1.19.0/rules_js-v1.19.0.tar.gz",
)
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()

load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
nodejs_register_toolchains(
    name = "nodejs",
    node_version = "18.12.1",
)

load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
npm_translate_lock(
    name = "npm",
    pnpm_lock = "//:pnpm-lock.yaml",
    verify_node_modules_ignored = "//:.bazelignore",
    npmrc = "//:.npmrc",
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()

load("@aspect_bazel_lib//lib:repositories.bzl", "register_jq_toolchains")
register_jq_toolchains()

# This _must_ be named `rules_prerender`, other names are currently unsupported.
http_archive(
    name = "rules_prerender",
    sha256 = "d84217a1ab79d1bca090efe82817f41aaa43610c3e3e7cd7e0a50ab4d198cb3c",
    strip_prefix = "rules_prerender-releases-0.0.22",
    url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.22.tar.gz",
)
load("@rules_prerender//:dependencies.bzl", "rules_prerender_dependencies")
rules_prerender_dependencies()
load("@rules_prerender//:repositories.bzl", "rules_prerender_repositories")
rules_prerender_repositories()
load(
    "@rules_prerender//:npm_repositories.bzl",
    prerender_npm_repositories = "npm_repositories",
)
prerender_npm_repositories()

Breaking changes

  • #26 - Improves tree shaking of JavaScript in prerender_pages(). Now only JavaScript which is referenced by an includeScript() call for a given page is included. Previously, all files referenced by includeScript() would be executed on all the pages. Now we only evaluate JavaScript on the pages it is actually required.
  • 8a6fa4e - Updates Node version. Node ^18.12.1 is now required.
  • fb3ad63 - Updates Bazel. Bazel 6 is now required.
  • 6609dc9 - Custom bundling is no longer supported. Improvements to bundling mean that there is no longer a singular entry point of all JavaScript code used in prerender_pages_unbundled(). Instead there is a TreeArtifact of entry points for each HTML file. This requires custom effort to support in a builder, as existing out-of-the-box bundlers like @aspect_rules_rollup do not support multiple entry points provided as a TreeArtifact at execution time. We'd like to support custom bundling in some capacity in the future, but as of now there is no easy way to do it.

Changelog

  • c07b684 - includeScript() loads its input in a module script (type="module").
  • f32b3d5 - @aspect_rules_rollup is no longer needed as a dependency.
  • 2e8c193 - @rollup/plugin-node-resolve is no longer needed as a dependency.