Releases: dgp1130/rules_prerender
Releases · dgp1130/rules_prerender
0.0.34
BREAKING CHANGES
- dbc79e7, d0ca850 - The
@rules_prerender/preact
implementation of<Template />
has been moved to@rules_prerender/declarative_shadow_dom/preact.mjs
. The new version automatically includes the DSD polyfill, meaning invokingpolyfillDeclarativeShadowDom
is no longer needed when using<Template />
.
Changelog
- b0d4401 - Adds
<InlinedSvg />
component to@rules_prerender/preact
which reads an SVG from binary runfiles and returns it as aVNode
to be directly included in application HTML. - 719cb36 - Fixes DSD polyfill to apply to nested DSD elements, rather than just the top-level elements.
- 5f7c09a - Adds re-export functionality to
css_library
. When nosrcs
are given, acss_library
target switches to a "reexport" of all its dependencies. - d9c9975 - Adds
CustomElement
type to@rules_prerender/preact
. This defines thedefer-hydration
attribute, making it easy to defer components which support the community protocol.
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 = "e3e6c3d42491e2938f4239a3d04259a58adc83e21e352346ad4ef62f87e76125",
strip_prefix = "rules_js-1.30.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.30.0/rules_js-v1.30.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 = "a10583fd0318da04945e3f2223a233849c0d90b9767672b836f95c86f44a2c6e",
strip_prefix = "rules_prerender-0.0.34",
url = "https://github.com/dgp1130/rules_prerender/releases/download/releases%2F0.0.34/rules_prerender-bazel_workspace-0.0.34.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()
0.0.33
Changelog
BREAKING CHANGES
- 20afcc6 (commit message is wrong, actually bumps to
1.30.0
), 8b69d22 - Peer dependency on@aspect_rules_js
has been bumped to^1.30.0
. This also bumps the required pnpm version to8.6.0
and likely requires migrating the lockfile version. - 0cd6762 -
@rules_prerender/declarative_shadow_dom/preact.mjs
Template
now usesshadowrootmode
instead ofshadowroot
to align with the specification. The DSD polyfill is also updated to only apply toshadowrootmode
templates.
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 = "e3e6c3d42491e2938f4239a3d04259a58adc83e21e352346ad4ef62f87e76125",
strip_prefix = "rules_js-1.30.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.30.0/rules_js-v1.30.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 = "eff3ea10322012bd87a814648558c9171a3f2f2756c26c38871e4e667e2317ab",
strip_prefix = "rules_prerender-0.0.33",
url = "https://github.com/dgp1130/rules_prerender/releases/download/releases%2F0.0.33/rules_prerender-bazel_workspace-0.0.33.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()
0.0.32
BREAKING CHANGES
- a1962af - The
bundle_js
flag has been removed. Client-side JavaScript is always bundled and does not throw an error if there are no scripts to bundle. Even if a page does not use JavaScript today, a component may add JavaScript in the future, and these scripts would not be enabled on any page withbundle_js = False
. As a result, it is best to always bundle client-side scripts. If a page happens to not have any, this is not considered an error or antipattern.
Changelog
- 18a8811 -
prerender_pages
no longer throws an error if there are no scripts to bundle. It now passes without error and injects no JavaScript files into the prerendered HTML. - 62f2eab -
prerender_pages
no longer emits a warning if a script is empty. This happens when an HTML page includes a singleincludeScript
of an empty file. If a script is empty, it will not be output by the bundling process and will not be injected into the page as a performance optimziation.
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 = "00e7b97b696af63812df0ca9e9dbd18579f3edd3ab9a56f227238b8405e4051c",
strip_prefix = "rules_js-1.23.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.23.0/rules_js-v1.23.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 = "36434a83e0b71b4fca0363b5ae50cc7c6878fe394c9900a03c3613ce15c6a538",
strip_prefix = "rules_prerender-0.0.32",
url = "https://github.com/dgp1130/rules_prerender/releases/download/releases%2F0.0.32/rules_prerender-bazel_workspace-0.0.32.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()
0.0.31
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 = "00e7b97b696af63812df0ca9e9dbd18579f3edd3ab9a56f227238b8405e4051c",
strip_prefix = "rules_js-1.23.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.23.0/rules_js-v1.23.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 = "21d9eedb9ecfd61b4eab9b0d0050fb8302db25982ce1087ae9a8497d88aac708",
strip_prefix = "rules_prerender-0.0.31",
url = "https://github.com/dgp1130/rules_prerender/releases/download/releases%2F0.0.31/rules_prerender-bazel_workspace-0.0.31.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
- The existing
prerender_component
,prerender_pages_unbundled
, andprerender_pages
have been deleted. - The following macros have been renamed:
prerender_component2
->prerender_component
prerender_pages_unbundled2
->prerender_pages_unbundled
prerender_pages2
->prerender_pages
.
- This effectively deletes the old implementation of these macros and promotes the 2 variant in their place. Going forward these will be the only supported implementation.
- See #40 for more info.
0.0.30
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 = "00e7b97b696af63812df0ca9e9dbd18579f3edd3ab9a56f227238b8405e4051c",
strip_prefix = "rules_js-1.23.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.23.0/rules_js-v1.23.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 = "93c9662e0cc8dd0e8a22c54555cfac1ef221cf5ec6cabe8cb79d8ee3d4ec9425",
strip_prefix = "rules_prerender-0.0.30",
url = "https://github.com/dgp1130/rules_prerender/releases/download/releases%2F0.0.30/rules_prerender-bazel_workspace-0.0.30.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
- #40 - Adds
prerender_component2
,prerender_pages_unbundled2
, andprerender_pages2
. Existing Bazel macros are unaffected, but will be replaced by these implementations. See this comment for details about the new design. Recommend migrating all existing usages to these new rules, as the old ones will soon be deleted.
0.0.28
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 = "00e7b97b696af63812df0ca9e9dbd18579f3edd3ab9a56f227238b8405e4051c",
strip_prefix = "rules_js-1.23.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.23.0/rules_js-v1.23.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 = "c79d491cce81faedd00bebf2cfacc8bf429e62eb262d6f8deced4e40cfabe6b7",
strip_prefix = "rules_prerender-releases-0.0.28",
url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.28.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
- e729b01, 5e97d86, 1ab5c34, 281e450 - Bumps Bazel
@aspect_rules_js
,@aspect_rules_ts
,@aspect_bazel_lib
, and@bazel_skylib
dependency versions.
Changelog
- 6c737aea5e0ee2143bbf44a54536e1f6b30399fc4 - Adds live reload functionality to
web_resources_devserver()
.
0.0.27
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 = "f598407027ad43c3386ea81548c323e8dc8bf054275cdc2c83c986f7916d3d99",
strip_prefix = "rules_prerender-releases-0.0.27",
url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.27.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
- 0aab086, 217ae5b, 73f61b6 - Splits
PrerenderResource.of()
intoPrerenderResource.fromText()
,PrerenderResource.fromBinary()
, andPrerenderResource.fromHtml()
. These different functionalities have different security characteristics which needed to be taken into account.fromText()
andfromBinary()
work just likePrerenderResource.of()
worked with a raw string or binary input, except that they throw an error when outputting to a*.html
or*.htm
file. This is for security reasons.PrerenderResource.fromHtml()
works likePrerenderResource.of()
worked forSafeHtml
inputs and is allowed to output to a*.htm
or*.html
file. - f32c6bc - Updates
renderToHtml()
to render "non-pretty" HTML. This removes leading and trailing whitespace unintentionally added by the rendering process when it was "prettified". This should be more accurate to the actual authored JSX.
Changelog
- 66339ec - Updates
renderToHtml()
to support rendering a component as the root element, so long as that component ultimately renders an<html />
tag as the top-level element.
0.0.26
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 = "7b48cc429c4979d53e98e2847cedfd10c2ce5e99388ec2c5be78d0c061ee372e",
strip_prefix = "rules_prerender-releases-0.0.26",
url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.26.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
- 46f5930 - Updates
Template
component to type check common HTML attributes.
Changelog
- e505ac2 - Adds Preact support to
@rules_prerender/declarative_shadow_dom
. ImportpolyfillDeclarativeShadowDom
from@rules_prerender/declarative_shadow_dom/preact.mjs
. This version returns aVDom
instance.
0.0.25
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 = "aed873ce3ec39d0077eab713623b074723d849f00aefb5d3d4ab8c859f25cda7",
strip_prefix = "rules_prerender-releases-0.0.25",
url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.25.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
- c146934 - Restricts visibility of some internal targets. These were never considered public API.
- a40f86c - Updates annotations to switch from an HTML comment syntax to a new HTML element syntax. You're not depending on this anyways, because you're a good user, and won't be affected. But if any mean users did depend on this, they would likely be broken.
Changelog
- 0bf6e70 - Adds
SafeHtml
and related functionality. This represents HTML content which has been sanitized and is "safe by construction". Eventually,PrerenderResource
will stop accepting raw strings as inputs. - #71 - Adds
@rules_prerender/preact
templating engine. This provides DOM sanitization through JSX templates and integrates withSafeHtml
. See documentation in README and example for more details. - 33f6c94 - Adds
--@rules_prerender//tools/flags:debug_prerender
. Recommend aliasing this to--debug_prerender
. Set this to invoke a specificprerender_pages()
target with--inspect-brk
and some extra flags to make it more debuggable. Usage:bazel build //path/to/pkg:target --debug_prerender=//path/to/pkg:some_prerender_pages_target
. More documentation in README.
0.0.24
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 = "6b20d04d00d9360c833921c8e04d4de0d9fd91a2745871f71b4719b183eb9929",
strip_prefix = "rules_prerender-releases-0.0.24",
url = "https://github.com/dgp1130/rules_prerender/archive/refs/tags/releases/0.0.24.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
- #69 -
includeScript()
andinlineStyle()
now accept relative file paths withimport.meta
as a second argument like so:
export default function* (): Generator<PrerenderResource, void, void> {
yield PrerenderResource.of('/index.html', `
<!DOCTYPE html>
<html>
<body>
${includeScript('./client.mjs', import.meta)}
${inlineStyle('./styles.css', import.meta)}
</body>
</html>
`.trim());
}
This makes imports easier to work with, since scripts and styles are typically right next to their associated prerender logic.
There are three notable constraints:
- Including resources from external repositories is not supported (it was only kinda supported beforehand).
- Paths must be relative file paths, you can't put an NPM package in there just yet (but maybe in the future?).
- Paths must end in appropriate file extensions (no Node resolution). This aligns with native ESM behavior.