Page MenuHomePhabricator

Code splitting: basic support for loading components
Closed, ResolvedPublic8 Estimated Story Points

Description

Step 1 from T349423:

Implement basic support for codexComponents in the CodexModule class: load the specified components and add them to the collector module; but without support for CSS-only or dependencies (there's a proof of concept sketch of this in this patch)

  • Preserve the existing CodexModule code (which is specific to the codex-styles and codex-search-styles modules) for now; but plan to remove it later
  • Add code that:
    • Determines which manifest file to use (LTR, RTL, legacy LTR or legacy RTL) based on the context
    • Determines which files to load from Codex, based on the codexComponents key in the module definition and the contents of the manifest file
    • Adds those files to the module object's packageFiles and styles properties
    • Adds a virtual codex-subset.js file that gets the requested components from the Codex files and exports them
  • Run that code when getPackageFiles, getStyleFiles or getDefinitionSummary are called, before calling the parent's implementation of those methods

This should not affect any existing code, as long as the existing code in CodexModule (used by the style modules) is preserved.

Event Timeline

Catrope set the point value for this task to 5.Oct 30 2023, 7:15 PM

Change 970421 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[mediawiki/core@master] Add module and manifest files to the codex RL module

https://gerrit.wikimedia.org/r/970421

egardner changed the point value for this task from 5 to 8.
egardner subscribed.

I've merged the task about style-only support here – it will be included in the basic patch.

Change 970908 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Basic tree-shaking in CodexModule

https://gerrit.wikimedia.org/r/970908

Change 972067 had a related patch set uploaded (by Eric Gardner; author: Anne Tomasevich):

[mediawiki/core@master] CodexModule: Add unit test for code splitting

https://gerrit.wikimedia.org/r/972067

Change 970421 merged by jenkins-bot:

[mediawiki/core@master] Add module and manifest files to the codex RL module

https://gerrit.wikimedia.org/r/970421

Change 970908 merged by jenkins-bot:

[mediawiki/core@master] Basic tree-shaking in CodexModule

https://gerrit.wikimedia.org/r/970908

Change 972067 merged by jenkins-bot:

[mediawiki/core@master] CodexModule: Add unit test for code splitting

https://gerrit.wikimedia.org/r/972067