Skip to content

fix(node-url-to-whatwg-url): support dynamic import for url.parse - #575

Open
vishalrajofficial wants to merge 1 commit into
nodejs:mainfrom
vishalrajofficial:fix-url-parse-dynamic-import
Open

vishalrajofficial wants to merge 1 commit into
nodejs:mainfrom
vishalrajofficial:fix-url-parse-dynamic-import

Conversation

@vishalrajofficial

Copy link
Copy Markdown

Fixes #515

Description

This PR adds support for dynamic imports of node:url when transforming url.parse calls to WHATWG URL:

  • Updates url-parse and url-format to use getModuleDependencies so dynamic import calls are included alongside static imports and CommonJS requires.
  • Enhances getNodeImportCalls in @nodejs/codemod-utils to identify await import(...) declarations that chain .then(...) callbacks.
  • Enhances resolveBindingPathImportCallback to resolve bindings when .then() callback parameters use destructuring (e.g. ({ parse: urlParse }) or ({ parse })).
  • Enhances resolveBindingPathRequire to resolve member bindings when await import(...).then(...) returns a module member.
  • Adds test fixtures and unit tests for dynamic import patterns.

Support dynamic imports of node:url when calling url.parse, including chained .then() callbacks and await import expressions.

Signed-off-by: Vishal Raj <9031842908.vk@gmail.com>
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.

bug(node-url-to-whatwg-url): url-parse didn't support dynamic import

1 participant