chore(deps): update dependency @datocms/cda-client to v0.3.0 - #277
Merged
Conversation
|
🎉 This PR is included in version 4.1.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
This PR contains the following updates:
^0.2.10→^0.2.10 || ^0.3.00.2.10→0.3.0Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
Release Notes
datocms/cda-client (@datocms/cda-client)
v0.3.0: —instanceof ApiErrornow worksCompare Source
instanceof ApiErrornow worksUntil this release,
error instanceof ApiErrorwas alwaysfalse— even with a single copy of the module loaded and no bundler involved:This failed silently: the guard compiled, type-narrowed, and simply never matched — so error handlers fell through to a generic 500 while looking perfectly correct.
Nothing to change on your side. Plain
instanceofnow works, including across duplicated copies of the package. If you worked around this with aname-based check, you can delete it:What was wrong
1. ES5 downlevel. Both tsconfigs set
"target": "es5", soclass ApiError extends Errorwas emitted as_this = _super.call(this, message) || this; … return _this.Error.call(this)ignoresthisand returns a fresh Error — and that object, being truthy, became the instance. Its prototype was thereforeError.prototype, neverApiError.prototype.The build target is now
es2017. The package is built on the browser Fetch API, so no real ES5 runtime could ever have executed it — the ES5 target was only costing correctness.2. Duplicate module copies. The package ships parallel CJS and ESM builds, so a bundler can load two distinct copies and therefore two distinct
ApiErrorclasses. A prototype check then fails for an error thrown by the other copy — and no packaging metadata fully prevents this, since a bundler may inline one copy while another stays external.ApiErrorinstances are now branded withSymbol.for('@datocms/cda-client:ApiError'), and the class implementsstatic [Symbol.hasInstance], makinginstanceofstructural rather than identity-based. The global symbol registry is shared across copies and realms, so the check holds wherever the error came from. Subclasses still fall back to a real prototype-chain check, so they stay exact.Packaging
The package now declares an
exportsmap, and relative imports carry.jsextensions so the ESM build is actually loadable. Previouslydist/esmused extensionless specifiers and had no"type": "module"marker, so importing it from Node failed withERR_MODULE_NOT_FOUND— it was bundler-only.Upgrade notes
Released as a minor rather than a patch, for two reasons:
fetch,Responseand promises, so this changes the syntax floor, not the practical runtime requirement.)exports. The map deliberately keeps./dist/*,./src/*and./package.jsonreachable, so existing deep imports keep working — butexportstargets don't get Node's extension guessing, so a deep import must now spell out the extension:@datocms/cda-client/dist/cjs/ApiError.js, not…/ApiError.Full Changelog: datocms/cda-client@v0.2.11...v0.3.0
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.