Skip to content

v0.8.2

Latest

Choose a tag to compare

@github-actions github-actions released this 06 Aug 22:58

Five things that worked in the build and not in npm run dev, one that worked in
neither, and a snippet that was wrong in the documentation.

Both packages move together: @transclude/core and @transclude/create are
0.8.2.

npm install @transclude/core@latest

0.8.1 was tagged and never published. GitHub queued its workflow and never ran
it, and by the time that was worked out there was a fix worth carrying, so this
release is both. Nothing is missing: everything written for 0.8.1 is here.

If you copied the bindings snippet, change it

The version shipped in 0.8.0 holds env in a module variable. In a transclude
app that does not work, and it fails quietly.

Two bundlers touch the file. The build inlines a copy into
dist/server/entry.js for your loaders, and wrangler bundles worker.js with a
second one. hold sets the variable in one copy and bindings reads the other,
which is still null.

// app/lib/bindings.js
const SLOT = Symbol.for('app.bindings');

export const hold = (env) => {
  globalThis[SLOT] = env;
};

export const bindings = () => globalThis[SLOT] ?? null;

A symbol in the global registry is one slot per isolate however many copies of
the module exist.

This was found on a live site rather than in a test. A form answered, the page
said what it was supposed to say, and the row went to the fallback the module
keeps for dev. Nothing logged anything. If you built on the old snippet, check
that what you think you are writing is arriving.

Fixed

A <script> the browser does not execute is markup now, not code to
compile.
Any type that is not JavaScript makes a script a data block, and
every one of them was read as a client module and compiled, which means
swallowed.

<script type="application/ld+json"></script>
<script type="importmap"></script>

Structured data, import maps, hand-written speculation rules, and anything a
library reads out of the document all disappeared from the page with nothing
said. A plain <script> and type="module" are unchanged.

Interpolating into one is still refused. Being markup does not make raw text
safe, and a ${…} there could close the element or the statement around it.

ctx.after and ctx.revalidateTag did not exist in the dev server. The dev
server builds its own context, and neither was on it. A loader calling one
worked in the build and threw after is not a function while you were writing
it.

revalidateTag is a no-op in dev, since nothing is held between requests there.
after behaves as it does on Node anywhere else.

/feed.xml, /sitemap.xml and the proxy route were 404 in dev. They are
mounted by createApp, which the dev server does not use, so a site with a
feed or a sitemap in its config had them in the build and nowhere else. The
sitemap had been that way for as long as the key has existed. The proxy was
worse: the route the browser calls returned 404 while you wrote the page and
worked once deployed.

/precache.json stays absent from dev, and that is a decision rather than the
same oversight. It names hashed asset filenames only the build knows, and a
service worker holding anything while you edit is a bug.

Four files carry the loader context and nothing linked them.
test/context-shape.test.js now compares src/app.js, bin/dev.js,
src/prerender.js and the type literal in src/typecheck.js.

A note on the version

A patch. Nothing in the built server changed, so a deployed site behaves as it
did on 0.8.0. What changed is the dev server catching up to it, the compiler
keeping data blocks it used to eat, and what the shipped skill teaches about
reaching a binding.

Full changelog: v0.8.0...v0.8.2