Releases: dgp1130/rules_prerender
0.0.23
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 = "23c1fbf35dfa0c01c9063b0f49eb846f87f9a4cfd2b4ed79152e7e140bc95fda",
strip_prefix = "rules_prerender-releases-0.0.23",
url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.23.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
- #33 -
@rules_prerender
now requires native EcmaScript modules (ESM). JavaScript source files should use ESM syntax (import
/export
) and TypeScript should emit usingmodule: "ES2020"
ormodule: "ES2015"
. You likely also wantmoduleResolution: "node"
and to name your files*.mjs
or*.mts
as well as import files via explicit*.mjs
extensions (import {} from './foo.mjs'
).
0.0.22
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 anincludeScript()
call for a given page is included. Previously, all files referenced byincludeScript()
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 aTreeArtifact
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 aTreeArtifact
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
0.0.21
Another botched release. Do not use.
Renaming things is hard.
0.0.20
Botched release. Failed to publish @rules_prerender/declarative_shadow_dom
. Do not use.
0.0.19
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 = "16.10.0",
)
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 = "b305b022dee5a9cff7164412d7d2ab8995d8a6c563076614abc29b08571336ec",
strip_prefix = "rules_prerender-releases-0.0.19",
url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.19.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()
Changelog
- 9733afd - Avoids overwriting the user's
@npm
workspace dependency.
0.0.18
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 = "16.10.0",
)
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()
# This _must_ be named `rules_prerender`, other names are currently unsupported.
http_archive(
name = "rules_prerender",
sha256 = "7c392b76f7f826ecdd9c284e545f2dc3b5f8b2b14a9e536ae81df3391cb36bf6",
strip_prefix = "rules_prerender-releases-0.0.18",
url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.18.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()
Changelog
- Fixes #46 - CSS bundling is now done with Lightning CSS instead of PostCSS. For the most part, this should not be an observable change. The biggest difference is that
@import
statements must be done to relative to the importing file such as@import './foo.css';
instead of@import 'my_wksp/path/to/pkg/foo.css';
. - Fixes #63 -
@build_bazel_rules_nodejs
is now completely removed as a dependency and does not need to be included inWORKSPACE.bazel
files. This also means you can delete yourpackage-lock.json
file and rely entirely onpnpm
. - 865910e, 865910e -
README
files have been updated to clarify installation and usage with@aspect_rules_js
, with more detail for@rules_prerender/declarative_shadow_dom
in particular.
0.0.17
Upgrades @rules_prerender
to use @aspect_rules_js
under the hood instead of @build_bazel_rules_nodejs
(see #48). This means applications need to use @aspect_rules_js
-ecosystem rules such as ts_project()
from @aspect_rules_ts
and js_library()
from @aspect_rules_js
. Otherwise the public API is mostly the same, with some minor tweaks to meet the new model.
The rules_prerender
NPM package now only contains the core runtime (PrerenderResource
, includeScript()
, inlineStyle()
, etc.) Published components must now be in their own NPM packages. This means that declarative shadow DOM support is now published under @rules_prerender/declarative_shadow_dom
.
While most of the BUILD rules are relatively unchanged, WORKSPACE
files and the set up experience is very different and noticeably more complicated. We're looking to improve this over time. For now, we must manage deps via both NPM and PNPM (maintain both lockfiles) and include @build_bazel_rules_nodejs
in addition to @aspect_rules_js
. The WORKSPACE
file currently looks like:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "dcc55f810142b6cf46a44d0180a5a7fb923c04a5061e2e8d8eb05ccccc60864b",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.0/rules_nodejs-5.8.0.tar.gz"],
)
load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
build_bazel_rules_nodejs_dependencies()
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 = "16.10.0",
)
load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")
npm_install(
name = "npm",
package_json = "//:package.json",
package_lock_json = "//:package-lock.json",
strict_visibility = False,
exports_directories_only = False,
)
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
npm_translate_lock(
name = "npm_user",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
npmrc = "//:.npmrc",
)
load("@npm_user//:repositories.bzl", "npm_repositories")
npm_repositories()
# This _must_ be named `rules_prerender`, other names are currently unsupported.
http_archive(
name = "rules_prerender",
sha256 = "8797660276fb25fde3545a44cda723042dd7d503cbdbe32710ac55439131ffce",
strip_prefix = "rules_prerender-releases-0.0.17",
url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.17.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()
Again, we're hoping to simplify this in the future, primarily by moving entirely off @build_bazel_rules_nodejs
.
As for BUILD
file changes, the most notable one is that using published components requires a link_prerender_component()
much like npm_link_package()
. In the root BUILD
file, include:
load("@npm_user//:defs.bzl", "npm_link_all_packages")
load("@rules_prerender//:index.bzl", "link_prerender_component")
# Make sure to `pnpm install` any published components.
npm_link_all_packages(name = "node_modules")
# Link each NPM package containing a prerender component.
link_prerender_component(
name = "prerender_components/@rules_prerender/declarative_shadow_dom",
package = ":node_modules/@rules_prerender/declarative_shadow_dom",
visibility = ["//visibility:public"],
)
Then depend on the //:prerender_components/*
target in the deps
of any prerender_component()
like so:
load("@rules_prerender//:index.bzl", "prerender_component")
prerender_component(
name = "component",
srcs = ["component.ts"],
deps = ["//:prerender_components/@rules_prerender/declarative_shadow_dom"],
)
0.0.16
https://www.npmjs.com/package/rules_prerender/v/0.0.16
Iterating on the release process, please ignore.
0.0.15
https://www.npmjs.com/package/rules_prerender/v/0.0.15
Changelog
- Refs #46 - CSS sourcemaps have been turned off to unblock the upgrade to the Node.js v16.10.0. See #46 (comment) for more details.
0.0.14
https://www.npmjs.com/package/rules_prerender/v/0.0.14
This release replaces all ts_library()
usages with ts_project()
. prerender_component()
now uses a ts_project()
under the hood and all examples / documentation have been updated to use ts_project()
in related targets. ts_library()
in userspace may still work in certain conditions, but is not supported or recommended in any situations.
Changelog
BREAKING CHANGES:
- Fixes #50 -
ts_project()
is now used across the board. This is more or less a drop-in replacement. See individual examples and documentation for specifics.
Other changes:
- Minor refactorings related to examples and documentation.