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

fix: circular dependencies #3081

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Commits on Sep 27, 2024

  1. fix(lib): circular dependency index.js <-> lib

    pool.js and pool_connection.js required index.js, and
    index.js required pool.js and pool_connection.js.
    
    Circular dependency can cause all sorts of problems.
    This fix aims to provide a step towards fixing a problem with
    @opentelemetry/instrumentation-mysql2, which looses several
    exports when using its patched require.
    
    For instance, `format` is lost and can cause an instrumented
    application to crash.
    tpraxl committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    33da6f7 View commit details
    Browse the repository at this point in the history
  2. fix: circular dependency index.js <-> promise.js

    index.js and promise.js require each other.
    
    Circular dependency can cause all sorts of problems.
    This commit aims to fix a problem with
    @opentelemetry/instrumentation-mysql2, which looses several
    exports when using its patched require.
    
    For instance, `format` is lost and can cause an instrumented
    application to crash.
    tpraxl committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    40053ad View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2024

  1. refactor: split common.js into lib modules

    The proposal to put common.js into lib was good, but it felt
    weird to arbitrarily stuff just some exported functions in
    lib/common.js. This made sense when common.js was meant
    to provide commons for index.js and promise.js. But
    in the lib, this felt like a weird scope.
    
    I therefore split common.js into
    
    - lib/create_connection.js
    - lib/create_pool.js
    - lib/create_pool_cluster.js
    
    Also made `require` more consistent in all affected files: all
    `require` files now have a js suffix when they refer to a
    single local file.
    tpraxl committed Sep 28, 2024
    Configuration menu
    Copy the full SHA
    fbb8ab1 View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2024

  1. fix: circular dependency to promise.js

    promise.js was required by lib sources, and promise.js required
    the same lib sources eventually. Extracted the respective
    classes to lib. Also extracted functions that are
    shared between several of the new files.
    
    Decided to put each exported class / function into its own file.
    This may bloat the lib folder a bit, but it provides clarity
    (where to find what).
    tpraxl committed Oct 3, 2024
    Configuration menu
    Copy the full SHA
    c11fc8d View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2024

  1. fix: missing patched functions

    The extraction of classes was performed without extracting
    the patch of methods like `escape`, etc.
    The patching is now performed in the files that define the
    respective classes, guaranteeing patched versions when
    these files are required.
    tpraxl committed Oct 19, 2024
    Configuration menu
    Copy the full SHA
    a1ec926 View commit details
    Browse the repository at this point in the history
  2. chore: remove unused require

    tpraxl committed Oct 19, 2024
    Configuration menu
    Copy the full SHA
    2ec00fe View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2024

  1. Configuration menu
    Copy the full SHA
    127df3c View commit details
    Browse the repository at this point in the history