Skip to content

v0.27.0

Choose a tag to compare

@joelmoss joelmoss released this 12 Oct 18:13
· 22 commits to master since this release

Breaking changes

  • The gem dependency context model moved into one Proscenium::Contexts namespace, under lib/proscenium/contexts/. The old constants and require paths are removed, with no aliases. Only code that reached into these internals directly is affected:

    Removed constant Removed require path Now
    Proscenium::ContextMap proscenium/context_map Proscenium::Contexts::Map
    Proscenium::StaleContexts proscenium/stale_contexts Proscenium::Contexts::Stale
    Proscenium::DependencyContext proscenium/dependency_context Proscenium::Contexts::Projection
    Proscenium::MappingGeneration proscenium/mapping_generation Proscenium::Contexts::MappingGeneration
    Proscenium::CLI::Contexts proscenium/cli/contexts Proscenium::Contexts::Plan
    Proscenium::CLI::Rules proscenium/cli/rules Proscenium::Contexts::Rules
    Proscenium::CLI::Error::CATALOG Proscenium::Contexts::Messages::TEXT (message and fix) and Proscenium::CLI::Error::STATUS (exit status)

    require 'proscenium' loads the whole namespace, so an app that only requires the gem needs no change.

  • Proscenium::Middleware::BuildError is removed. Nothing ever raised it: every build error is Proscenium::Builder::BuildError. A rescue_from Proscenium::Middleware::BuildError now raises NameError when it loads, so rescue Proscenium::Builder::BuildError instead.

Fixes

Puma preload_app!

  • Naming a Proscenium::Builder constant no longer starts the Go runtime. Only the first actual build does. A rescue_from Proscenium::Builder::BuildError in a controller loaded while Puma boots with preload_app! started Go before the fork, and Go cannot survive a fork (golang/go#15538), so the forked worker hung on its first build.

Tag helpers

  • javascript_include_tag and stylesheet_link_tag find a precompiled source in the manifest. The lookup missed every time, so javascript_include_tag 'app/components/x' served the undigested source URL, and a gem source rendered an array into src.
  • A gem source with no manifest entry, as in development, gets its /node_modules/@rubygems/... URL. It rendered /@rubygems/..., which nothing serves.

CSS

  • A stylesheet comes out as written, apart from the mixins it expands. Every stylesheet was written back by an old tokenizer, which turned an escaped leading digit into a control character: Tailwind's .\32xl\:text-lg (2xl:) became .\2xl… and silently matched nothing. Single quotes, CRLF line endings and form feeds were rewritten too. Mixins are now expanded over esbuild's own lexer, and the riking/cssparse dependency is gone.
  • A mixin file saved mid-edit is refused with a warning, instead of breaking every stylesheet that uses it. A definition the file never closes, such as one ending inside an open comment, url( or escape, ran on into each stylesheet including the mixin and swallowed the rest of it.

Imports from a gem

  • A bare import from a gem's files follows one lookup order, bounded to the gem and app roots:

    • a gem with a dependency context resolves from that context only;
    • a package the gem lists in peerDependencies resolves from the app first, so a gem developed locally with its own React installed still gets the app's;
    • the gem's own source looks in the nearest node_modules up to the gem root, then the app root;
    • a file of a package the gem ships resolves beside that package first, then from the app root.

    The old node_modules/@rubygems/<gem> npm-installed layout is no longer looked up.

  • A module that a package's browser field disables now bundles as an empty module, instead of failing the build.

proscenium install --frozen

  • install --frozen names the same cause for a stale context as the engine and inspect do. It said "its NPM dependencies changed" for a context edited by hand, or one whose only change was an edited projectionSha256.

Public API

  • README's new "Extending Proscenium" section lists the API component gems build on, and the protocol the engine calls back into, each part now tagged @api public and tested.

Documentation

  • Files under /vendor are served as they are, without building, under Cache-Control: public, max-age=3155695200, immutable. README now says so, and that each vendored file needs a version in its path that changes when the file does.