Skip to content

Conversation

TomStrepsil
Copy link
Contributor

@TomStrepsil TomStrepsil commented Jul 29, 2025

Issue

resolves #54
enables #46

Details

Change the webpack package so that rather than using import.meta.webpackContext to create a context module, hand-roll an equivalent data structure (mapping paths to statically-imported modules), and perform the same chaining of module splits as is afforded by this API (i.e. cascade context targets that themselves have a contextual split).

Rather than the bespoke require.context data structure, a simpler Map is produced by the join point generator, passing it to the point cut as variantPathMap (from variants), which in turn passes it to the toggle handler. This represents a breaking change for consumers that have used a bespoke toggle handler.

Scout Rule

webpack package

  • remove NextJs peer dependency, there's no reason to be explicit
  • ensured unresolvable files (can happen if node_modules part of the app root, and something odd has happened) are skipped
  • refactored the webpackNormalModule option to just take a module, rather than an async function - born out of a mistake when importing originally, I assume
  • consolidated defaulting of options to single method, rather than separating point cut defaults from plugin core defaults, for simplicity
  • ensured circular references don't cause the module graph walk to lock up
  • let enhanced-resolve attempt resolution in a try/catch, to support module alias etc.
  • fixed documentation to indicate toggleHandler is an option of the pointCut, not general plugin configuration

repo root / examples

express example

  • removed "Vary" header from "animals" example, the page is meant to be un-cacheable, and the value was wrong in any case

all examples

  • moved to import typescript types explicitly (as type) after unexpected pipeline failure

Upgrade Guide

  • If a bespoke toggleHandler has been specified in the Webpack plugin, this should be updated to take a variantPathMap argument (which is a Map) in place of a variants argument which was a require.context module.

See changes to examples/serve/src/toggleHandlers in this PR for reference.

  • If a webpackNormalModule has been supplied, this should now return an imported module itself, rather than an resolution function

CheckList

  • PR starts with [ISSUE_ID].
  • Has been tested (where required) before merge to main.

TomStrepsil and others added 11 commits December 24, 2024 17:31
* rename to proper module namespace

* update docs links

* update versions

* web toggle point in readme title

* fixup changelog from revised 0.x range

* 2.0.0 -> 0.5.0 in oss version scheme

* fix broken link syntax in CHANGELOG

* consistent quoting

* more version history issues

* fixup module name in jsdoc

* add web
remove sdkInstanceProvider

* remove SDKInstanceProvider

* fixup jsdoc dedupe

* tweak

* clarity re: ssr package

* casing etc
* update workflows

* version

* typo

* update chromium linux snaps

* versions for serve update

* package.json repository field

* update root package.lock

* bugs & directories/doc fields

* fix changelog

---------

Co-authored-by: Tom Pereira <tom.pereira@johnlewis.co.uk>
Co-authored-by: Tom Pereira <tom.pereira@johnlewis.co.uk>
@TomStrepsil TomStrepsil requested a review from a team as a code owner July 29, 2025 20:27
@TomStrepsil TomStrepsil changed the title [54] support bidirectional filesystem conventions [54] support bi-directional filesystem conventions Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants