Skip to content

Allow .cjs and .mjs files to be shadowed - #8418

Open
kunalKumar-13 wants to merge 1 commit into
plone:18.x.xfrom
kunalKumar-13:backport-18-799e67d81-main
Open

Allow .cjs and .mjs files to be shadowed#8418
kunalKumar-13 wants to merge 1 commit into
plone:18.x.xfrom
kunalKumar-13:backport-18-799e67d81-main

Conversation

@kunalKumar-13

Copy link
Copy Markdown
Contributor

Backport of #8413 to 18.x.x, as requested.

Cherry-picked from 799e67d81 with -x; it applied without conflicts, and the
glob line it changes is identical on this branch.

packages/registry is green here: 4 test files, 83 tests. I also checked the
backported test is doing its job on 18.x.x rather than passing regardless —
reverting just the glob change fails addon-registry.test.js on the .cjs
alias assertion.

Copilot AI lite review requested due to automatic review settings September 4, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is small, targeted, and includes a fixture-backed test assertion that verifies .cjs shadows are discovered and aliased correctly without altering the alias key stripping behavior.

Pull request overview

This PR backports the fix from #8413 to the 18.x.x branch so that Volto customizations can shadow core modules implemented as CommonJS/ESM modules with .cjs/.mjs extensions (previously ignored by the customization file glob).

Changes:

  • Extend the addon-registry customization file glob to include cjs and mjs.
  • Add a .cjs shadow pair to the registry test fixture to exercise the behavior.
  • Update the addon-registry test to assert that .cjs shadow aliases are generated with the extension preserved.
File summaries
File Description
packages/registry/src/addon-registry/addon-registry.ts Adds `cjs
packages/registry/news/8366.bugfix Adds a news fragment documenting the bugfix/backport.
packages/registry/tests/fixtures/test-volto-project/src/customizations/constants/Languages.cjs Adds a .cjs customization fixture.
packages/registry/tests/fixtures/test-volto-project/node_modules/@plone/volto/src/constants/Languages.cjs Adds a .cjs “core” fixture module to be shadowed.
packages/registry/tests/addon-registry.test.js Asserts the .cjs alias key is present and retains its extension.
Review details
  • Files reviewed: 4/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants