Skip to content

Roadmap: reliability and performance as first-class citizens #21

Description

@mhenrixon

Roadmap: reliability and performance as first-class citizens

Problem / Goal

importmap-plus already does what importmap-rails does plus minification, esm.run bundles, version locks and provenance. Two things still make an app depend on a CDN at runtime or on a developer's vigilance:

  1. Packages that can't be vendored as one file. A live probe of 20 popular packages through jspm today: 9 of 18 that resolved ship a file that imports siblings by relative path (import"./_/f08a6ffe.js", from"../_/f09ec963.js", import('../photoswipe.js')), pdfjs-dist also spawns new Worker(…), ace-builds too, and 2 (@mui/material, mermaid) don't resolve on jspm at all. pin vendors the entry anyway and the browser 404s on the siblings. Upstream calls this expected behaviour (Relative paths in importmaps js default to my domain rails/importmap-rails#295, Supporting package directory downloads rails/importmap-rails#302 open since 2024, Download all the files associated with a package from a CDN rails/importmap-rails#235 stalled on Propshaft not rewriting imports). An app on this gem is holding @basis-theory/web-elements at 2.x for exactly this reason.
  2. No verification, no fallback, no tuning. jspm 404s or lags npm and pin just gives up; a remote pin ships without an integrity hash; nothing checks the app's import map before a page does; every preload: true pin is preloaded on every page (a real app had to hand-write preload: false on apexcharts/core to stop 1.1 MB per page); modulepreload links wait for the HTML.

Done looks like: bin/importmap pin always ends with a working pin — vendored with its whole file graph when it can be, remote with a recorded reason and an integrity hash when it can't, from whichever CDN can actually serve the registry's latest — bin/importmap doctor proves the app's map in CI, and the page preloads what it will use, as early as the server allows.

The pieces, in execution order

# Issue Layer Depends on
1 #14 pin keeps a package remote when its file can't stand alone, and says why CLI + Packager — (bumps VERSION to 1.2.0)
2 #15 registry-latest resolution and jspm → esm.run → jsdelivr fallback CLI + Packager + Npm #14
3 #16 remote pins get a subresource-integrity hash CLI + Packager #14
4 #17 pin vendors a package's whole file graph Packager (new collaborator) #14
5 #18 bin/importmap doctor CLI (new collaborators) #14, #16
6 #19 graph-aware preloading (config.importmap.preload_strategy = :reachable) Map + engine (request path) #18
7 #20 103 Early Hints for modulepreload helper + engine best after #19

Each child issue is self-contained: context files, the decision with rejected alternatives, ordered TDD steps, verification gates, out-of-scope. Run them one at a time with /lfg <number>; each is one PR.

Rules that apply to every child

Settled in interview (do not re-litigate)

  • Epic + child issues, executed in order.
  • Reason recorded in the provenance comment: # @<ver> (remote: <reason>), detail order provider, minified, remote, locked.
  • Phase 2 vendors the file graph (flat entry + vendor/javascript/<pkg>/ directory + one pin_all_from line with relative imports rewritten to bare keys), not a public/ mirror.
  • Fallback is automatic: registry latest first, then jspm → esm.run → jsdelivr; --from disables it.
  • Roadmap scope: doctor, remote SRI, graph-aware preloading, Early Hints — all in.

Upstream-first notes

#19 (graph-aware preloading) and #20 (Early Hints) are not fork-specific; propose them to rails/importmap-rails after they land here so the next sync shrinks the diff. #14, #15, #16, #17, #18 lean on fork provenance or on behaviour upstream has declined.

Evidence

Execution

Start with /lfg 14.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    roadmapReliability and performance roadmap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions