Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(main|extract): adds builtInModules option to tweak what to consider built-in (/ core) modules #847

Merged
merged 4 commits into from
Sep 30, 2023

Conversation

sverweij
Copy link
Owner

@sverweij sverweij commented Sep 30, 2023

Description

  • adds a builtInModules option to tweak what to consider built-in (/ core) modules

Motivation and Context

By default dependency-cruiser considers nodejs built-in modules as core modules. In other contexts this might be not (entirely) right:

  • when targeting the browser, the core modules are either not available or you're using a shim (e.g. https://www.npmjs.com/package/path). In these cases dependency-cruiser should respectively flag the included core module as unresolvable or resolve it to node_modules/path
  • when targeting a platform built on top of nodejs, like electron, you might want to specify the packages built into that platform as.

This PR adds options for both of these. See the documentation included in this PR for details

Fixes #845

How Has This Been Tested?

  • green ci
  • additional automated tests

Types of changes

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

Checklist

  • 📖

    • My change doesn't require a documentation update, or ...
    • it does and I have updated it
  • ⚖️

    • The contribution will be subject to The MIT license, and I'm OK with that.
    • The contribution is my own original work.
    • I am ok with the stuff in CONTRIBUTING.md.

@sverweij sverweij marked this pull request as ready for review September 30, 2023 12:07
@codeclimate
Copy link

codeclimate bot commented Sep 30, 2023

Code Climate has analyzed commit c533f88 and detected 0 issues on this pull request.

View more on Code Climate.

@sverweij sverweij changed the title feat(main|extract): adds builtInModules option to tweak what to consider built-in (/ core) modules feature(main|extract): adds builtInModules option to tweak what to consider built-in (/ core) modules Sep 30, 2023
@sverweij sverweij merged commit ddd2ee6 into main Sep 30, 2023
7 checks passed
@sverweij sverweij deleted the feature/override-builtin-modules branch September 30, 2023 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: is it possible to ignore nodejs builtins (and resolve to e.g. node_modules instead)?
1 participant