Skip to content

fix: backward-compat for ESM etherpad#130

Merged
SamTV12345 merged 1 commit into
mainfrom
fix/esm-compat
May 25, 2026
Merged

fix: backward-compat for ESM etherpad#130
SamTV12345 merged 1 commit into
mainfrom
fix/esm-compat

Conversation

@SamTV12345

Copy link
Copy Markdown
Member

This PR makes the plugin backward-compatible with the upcoming ESM etherpad branch (ether/etherpad#7605).

Changes:

  1. Remove trailing slash from require("ep_etherpad-lite/node/eejs/")require("ep_etherpad-lite/node/eejs") (in index.js)
  2. Replace require("ep_etherpad-lite/node_modules/async") with require("async") (in exportWhoDidWhat.js)

Both changes are backward-compatible with the current CJS etherpad release.

- Drop trailing slash on ep_etherpad-lite/node/eejs/ require (index.js)
- Replace ep_etherpad-lite/node_modules/async with async (exportWhoDidWhat.js)

Backward-compatible with current CJS etherpad release; also
compatible with the upcoming ESM etherpad branch which has stricter
exports map resolution.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Review Summary by Qodo

Fix ESM compatibility with stricter exports map resolution

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Remove trailing slash from eejs require path for ESM compatibility
• Replace internal node_modules async path with direct dependency
• Add async as explicit dependency in package.json
• Bump version to 11.0.31
Diagram
flowchart LR
  A["Require paths<br/>with internal refs"] -->|"Remove trailing slash<br/>& use direct deps"| B["ESM-compatible<br/>require statements"]
  C["Implicit async<br/>dependency"] -->|"Add to<br/>package.json"| D["Explicit async<br/>dependency"]
  B --> E["Backward-compatible<br/>with CJS & ESM"]
  D --> E

Loading

File Changes

1. exportWhoDidWhat.js 🐞 Bug fix +1/-1

Replace internal async path with direct require

• Replace require('ep_etherpad-lite/node_modules/async') with require('async')
• Removes internal node_modules path reference for better module resolution

exportWhoDidWhat.js


2. index.js 🐞 Bug fix +1/-1

Remove trailing slash from eejs require path

• Remove trailing slash from require('ep_etherpad-lite/node/eejs/') to
 require('ep_etherpad-lite/node/eejs')
• Fixes ESM exports map resolution which doesn't accept trailing slashes

index.js


3. package.json Dependencies +3/-2

Add async dependency and bump version

• Add async as explicit dependency with version ^3.2.6
• Bump package version from 11.0.30 to 11.0.31
• Makes previously implicit async dependency explicit

package.json


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented May 25, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1)

Grey Divider


Action required

1. No regression test for ESM 📘 Rule violation ☼ Reliability
Description
This PR changes module resolution behavior (require('async') and require('.../eejs')) but does
not add or update any regression tests in the same commit. Without a targeted test, the ESM/CJS
compatibility fix can silently regress in future changes.
Code

exportWhoDidWhat.js[3]

Evidence
PR Compliance ID 1 requires every bug fix to include a regression test in the same commit. The diff
shows bug-fix changes to module imports in exportWhoDidWhat.js and index.js, but no accompanying
changes to any test files.

AGENTS.md: Every Bug Fix Must Include a Regression Test in the Same Commit
exportWhoDidWhat.js[1-4]
index.js[20-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR is a bug fix for upcoming ESM Etherpad compatibility, but it does not include a regression test added/updated in the same commit.

## Issue Context
The changes adjust Node module resolution paths:
- `exportWhoDidWhat.js` now uses `require('async')`.
- `index.js` now uses `require('ep_etherpad-lite/node/eejs')` (no trailing slash).
A regression test should be added so future refactors don’t revert to the incompatible require paths.

## Fix Focus Areas
- static/tests/backend/specs/esm_compat_require_paths.js[1-120]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Outdated pnpm lockfile 🐞 Bug ☼ Reliability
Description
package.json adds the new runtime dependency "async" but pnpm-lock.yaml is not updated, so `pnpm i
--frozen-lockfile` will fail due to the manifest/lock mismatch. This can break the npm publish
workflow and any other installation path that relies on a frozen lockfile.
Code

package.json[R27-30]

Evidence
The code now requires async at runtime and package.json declares it, but pnpm-lock.yaml still
lists only ep_plugin_helpers under dependencies; the publish workflow uses `pnpm i
--frozen-lockfile, which fails when the lockfile doesn’t match package.json`.

exportWhoDidWhat.js[1-6]
package.json[27-30]
pnpm-lock.yaml[7-23]
.github/workflows/npmpublish.yml[70-73]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
A new dependency (`async`) was added to `package.json`, but `pnpm-lock.yaml` was not regenerated. This causes `pnpm i --frozen-lockfile` to deterministically fail because the lockfile no longer matches the manifest.

### Issue Context
This repo has a publish workflow that explicitly runs `pnpm i --frozen-lockfile`, so a lock mismatch will break the release pipeline.

### Fix
1. Run `pnpm install` (or `pnpm i`) in the repo root to update `pnpm-lock.yaml`.
2. Commit the resulting `pnpm-lock.yaml` changes.

### Fix Focus Areas
- package.json[27-30]
- pnpm-lock.yaml[7-23]
- .github/workflows/npmpublish.yml[70-73]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread exportWhoDidWhat.js
'use strict';

const async = require('ep_etherpad-lite/node_modules/async');
const async = require('async');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. No regression test for esm 📘 Rule violation ☼ Reliability

This PR changes module resolution behavior (require('async') and require('.../eejs')) but does
not add or update any regression tests in the same commit. Without a targeted test, the ESM/CJS
compatibility fix can silently regress in future changes.
Agent Prompt
## Issue description
The PR is a bug fix for upcoming ESM Etherpad compatibility, but it does not include a regression test added/updated in the same commit.

## Issue Context
The changes adjust Node module resolution paths:
- `exportWhoDidWhat.js` now uses `require('async')`.
- `index.js` now uses `require('ep_etherpad-lite/node/eejs')` (no trailing slash).
A regression test should be added so future refactors don’t revert to the incompatible require paths.

## Fix Focus Areas
- static/tests/backend/specs/esm_compat_require_paths.js[1-120]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread package.json
Comment on lines 27 to 30
"dependencies": {
"ep_plugin_helpers": "^0.6.2"
"ep_plugin_helpers": "^0.6.2",
"async": "^3.2.6"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

2. Outdated pnpm lockfile 🐞 Bug ☼ Reliability

package.json adds the new runtime dependency "async" but pnpm-lock.yaml is not updated, so `pnpm i
--frozen-lockfile` will fail due to the manifest/lock mismatch. This can break the npm publish
workflow and any other installation path that relies on a frozen lockfile.
Agent Prompt
### Issue description
A new dependency (`async`) was added to `package.json`, but `pnpm-lock.yaml` was not regenerated. This causes `pnpm i --frozen-lockfile` to deterministically fail because the lockfile no longer matches the manifest.

### Issue Context
This repo has a publish workflow that explicitly runs `pnpm i --frozen-lockfile`, so a lock mismatch will break the release pipeline.

### Fix
1. Run `pnpm install` (or `pnpm i`) in the repo root to update `pnpm-lock.yaml`.
2. Commit the resulting `pnpm-lock.yaml` changes.

### Fix Focus Areas
- package.json[27-30]
- pnpm-lock.yaml[7-23]
- .github/workflows/npmpublish.yml[70-73]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@SamTV12345 SamTV12345 merged commit 123bff5 into main May 25, 2026
3 checks passed
@SamTV12345 SamTV12345 deleted the fix/esm-compat branch May 25, 2026 16:01
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.

1 participant