Skip to content

refactor: use built-in escapeRegExp util#4109

Merged
pi0 merged 2 commits intonitrojs:mainfrom
ofershap:replace-escape-string-regexp
Apr 25, 2026
Merged

refactor: use built-in escapeRegExp util#4109
pi0 merged 2 commits intonitrojs:mainfrom
ofershap:replace-escape-string-regexp

Conversation

@ofershap
Copy link
Copy Markdown
Contributor

@ofershap ofershap commented Mar 14, 2026

tiny-escape has the same API as escape-string-regexp. Ships ESM + CJS with built-in TypeScript types. 192 bytes gzipped, zero deps.

https://npmgraph.js.org/?q=tiny-escape

@ofershap ofershap requested a review from pi0 as a code owner March 14, 2026 12:48
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 14, 2026

@ofershap is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 52080458-491f-4c4d-ba04-653e2eb36dc1

📥 Commits

Reviewing files that changed from the base of the PR and between b92a5a3 and 960f5d9.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json
  • src/config/resolvers/imports.ts
💤 Files with no reviewable changes (1)
  • package.json

📝 Walkthrough

Walkthrough

Removed the escape-string-regexp devDependency from package.json and replaced its usage in src/config/resolvers/imports.ts with a local escapeRegExp helper when building the options.imports.exclude RegExp. No public API or exported signatures changed.

Changes

Cohort / File(s) Summary
Package manifest
package.json
Removed escape-string-regexp from devDependencies (no other dependency or script edits).
Imports resolver
src/config/resolvers/imports.ts
Replaced call to external escapeRE with a local escapeRegExp helper when constructing the RegExp for options.imports.exclude; control flow and behavior unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows conventional commits format (refactor: ...) and clearly describes the main refactoring change of replacing escape-string-regexp with a built-in utility.
Description check ✅ Passed The description is related to the changeset, explaining the rationale for replacing escape-string-regexp with tiny-escape and providing relevant package details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pi0
Copy link
Copy Markdown
Member

pi0 commented Mar 14, 2026

nice find! We actually have builtin utils wondering might be best to just refactor and use them https://github.com/nitrojs/nitro/blob/main/src/utils/regex.ts

@pi0 pi0 changed the title replace escape-string-regexp with tiny-escape refactor: use built-in escapeRegExp util Apr 24, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 24, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4109

commit: 960f5d9

@pi0 pi0 merged commit feebdc1 into nitrojs:main Apr 25, 2026
12 of 13 checks passed
RihanArfan pushed a commit that referenced this pull request Apr 27, 2026
Co-authored-by: Ofer Shapira <[email protected]>
Co-authored-by: Pooya Parsa <[email protected]
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