feat(plugin): WordPress.org submission prep, docs cleanup, ESM scripts - #240
Conversation
|
Too much diff to scan? Review this PR in Change Stack to start with the highest-impact changes. Warning Review limit reached
More reviews will be available in 53 minutes and 3 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (32)
📝 WalkthroughWalkthroughThis PR converts the package and all build/test tooling from CommonJS to ES modules: package.json sets "type":"module"; scripts and Playwright tests switch require/module.exports/__dirname to import/import.meta.dirname/ES exports; optional dev deps retain createRequire fallbacks where needed. ChangesESM module system conversion
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package.json`:
- Line 3: The project's package.json sets "type": "module", but test files like
tests/token-api.spec.js and tests/tokens.spec.js are written as CommonJS (use
require and __dirname) and will fail as ESM; fix by either renaming those test
files to .cjs so Node treats them as CommonJS, or convert each spec to ESM by
replacing require(...) with import statements and any __dirname usage with path
resolution using import.meta.url (or, if you must keep CommonJS syntax,
explicitly use createRequire to load modules), ensuring all test files follow
the same module style.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 01fb8b1b-ecc8-4930-82fc-e0f707dfc4ee
⛔ Files ignored due to path filters (3)
plugins/SLASHED-for-WP/dist/slashed.essential.cssis excluded by!**/dist/**plugins/SLASHED-for-WP/dist/slashed.full.cssis excluded by!**/dist/**plugins/SLASHED-for-WP/dist/slashed.optimal.cssis excluded by!**/dist/**
📒 Files selected for processing (12)
package.jsonscripts/audit.jsscripts/bundle.jsscripts/check-artifacts.jsscripts/check-cheatsheet.jsscripts/gen-bricks-inventory.jsscripts/gen-class-hints.jsscripts/gen-class-reference.jsscripts/gen-token-reference.jsscripts/registry-sources.jsscripts/version-sync.jsscripts/zip-plugin.js
Eliminates the [MODULE_TYPELESS_PACKAGE_JSON] Node warning. All 11 scripts converted from CommonJS (require/module.exports/__dirname) to ES modules (import/export/import.meta.dirname). Optional lightningcss dependency in bundle.js uses createRequire as a bridge so the dynamic try/catch import path still works. https://claude.ai/code/session_01NQDBMUYWyjsrBrxvi5DxCK
Missed in the CJS→ESM conversion; "type": "module" in package.json caused Playwright to fail with "require is not defined in ES module scope". https://claude.ai/code/session_01NQDBMUYWyjsrBrxvi5DxCK
All 18 tests/*.spec.js files missed in the initial CJS→ESM pass. "type": "module" in package.json caused Playwright to fail with "require is not defined in ES module scope" for every spec file. https://claude.ai/code/session_01NQDBMUYWyjsrBrxvi5DxCK
File arrived from main after rebase; still had require() calls. https://claude.ai/code/session_01NQDBMUYWyjsrBrxvi5DxCK
cb67b53 to
34749a1
Compare
$(cat <<'EOF'
Summary
readme.txtwith correct contributor/tested-up-to,load_plugin_textdomain()on all three plugin entry points, standalone dist path fixed (../../../../dist/→../../dist/), atomic bundle downloads via WP_Filesystem (stage to.tmp, rename only when all 3 succeed)docs/bricks-template-workflow.mdfrom Polish to English, fixed stale facts; stripped meta commentary fromdocs/roadmap.md,docs/rebemer.md, and plugin README; renumbered reBEMer sections sequentially with updated cross-referencesscripts/*.jsconverted from CommonJS (require/module.exports/__dirname) to ES modules (import/export/import.meta.dirname);"type": "module"added topackage.json— eliminates[MODULE_TYPELESS_PACKAGE_JSON]Node warning. All 64 unit tests pass.Test plan
node scripts/bundle.js— all bundles build without errornode scripts/audit.js --check— 806 tokens, 160 .sf-classes, 40 .is-classesgen-token-reference,gen-class-reference,gen-bricks-inventory,gen-class-hints,check-cheatsheet)node --test tests/element-types.test.js tests/class-hints.test.js tests/color-model.test.js— 64/64 passnode scripts/zip-plugin.js— producesdist/slashed.ziphttps://claude.ai/code/session_01NQDBMUYWyjsrBrxvi5DxCK
EOF
)
Generated by Claude Code
Summary by CodeRabbit
Chores
Tests