fix(log): fix nodejs12 compatibility#1380
Merged
antongolub merged 4 commits intogoogle:mainfrom Feb 2, 2026
Merged
Conversation
Collaborator
|
Hey, @Ayoub-Mabrouk, Lets apply the fix only to the |
cf70678 to
1909817
Compare
Contributor
Author
Hello @antongolub, thanks for the feedback, done. |
Collaborator
|
Commits must have verified signatures |
.replaceAll() requires Node 15+ but engines field claims >= 12.17.0. Use .replace(/\n/g, ...) instead to maintain backward compatibility.
* chore: apply prettier * chore: update jsr to v0.14.2
95c39ab to
428870b
Compare
antongolub
approved these changes
Feb 2, 2026
Ayoub-Mabrouk
added a commit
to Ayoub-Mabrouk/zx
that referenced
this pull request
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue affects:
src/log.tsuses.replaceAll()informatCmd()function.replaceAll()which prevents building on Node 12-14Solution
This PR replaces all
.replaceAll()calls with.replace(/pattern/g, ...)to maintain backward compatibility with Node 12.17.0+ as specified in theenginesfield.Changes Made
src/log.ts: Replace.replaceAll('\n', ...)with.replace(/\n/g, ...)scripts/build-versions.mjs: Replace 3.replaceAll()calls with regex-based.replace()scripts/build-js.mjs: Replace 6.replaceAll()calls with regex-based.replace()scripts/build-dts.mjs: Replace.replaceAll()with regex-based.replace()build/core.cjsandbuild/3rd-party-licensesI chose to fix the code rather than update the
enginesfield to>= 15.0.0for the following reasons:package.json. Changing this would be a breaking change for users on Node 12-14..replaceAll()with.replace(/pattern/g, ...)maintains identical functionality while supporting older Node versions..replaceAll(), just with broader compatibility.Alternative Approach
If the maintainers prefer to drop support for Node 12-14, I'm happy to create a separate PR that:
enginesfield to">= 15.0.0".replaceAll()as-isThis would be a cleaner solution if backward compatibility with Node 12-14 is no longer a priority.