Skip to content

Replace url-parse with WHATWG URL in core and content#464

Open
patelti4 wants to merge 3 commits intoSitecore:devfrom
patelti4:fix/replace-url-parse
Open

Replace url-parse with WHATWG URL in core and content#464
patelti4 wants to merge 3 commits intoSitecore:devfrom
patelti4:fix/replace-url-parse

Conversation

@patelti4
Copy link
Copy Markdown

@patelti4 patelti4 commented May 5, 2026

Description / Motivation

This PR replaces direct url-parse usage in @sitecore-content-sdk/core and @sitecore-content-sdk/content with the WHATWG URL API.

Motivation:

  • Node 24 emits DEP0169 warnings for legacy url.parse() behavior
  • In a downstream Next.js build, tracing deprecations pointed the warning to the GraphQL client path in packages/core/src/graphql-request-client.ts
  • packages/content/src/media/media-api.ts also used url-parse, so this removes the remaining first-party usage in the affected packages
  • The url-parse README notes that the package predates broad WHATWG URL support and says to “consider using it for better security and accuracy”

Changes:

  • Replaced GraphQL endpoint validation in packages/core/src/graphql-request-client.ts with WHATWG URL
  • Reworked media URL parsing and serialization in packages/content/src/media/media-api.ts to use WHATWG URL while preserving relative URL behavior
  • Updated unit tests in both packages
  • Removed direct url-parse and @types/url-parse dependencies from packages/core and packages/content

Testing Details

  • Unit Test Added
  • Manual Test/Other (Please elaborate)

Manual/other validation included running root-level lint, tests, API surface verification, and build checks, plus package-level test runs for @sitecore-content-sdk/core and @sitecore-content-sdk/content.

Validation run from the monorepo root:

  • yarn lint-packages
  • yarn test-packages
  • yarn api-extractor:verify
  • yarn build

Additional package-level validation:

  • yarn workspace @sitecore-content-sdk/core test
  • yarn workspace @sitecore-content-sdk/content test

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@patelti4 patelti4 marked this pull request as draft May 5, 2026 06:05
@patelti4 patelti4 marked this pull request as ready for review May 5, 2026 06:06
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

⚠️ No Changeset found

Latest commit: d966807

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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