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

Added getDialectByNameOrAlias and converted repo to use it. #5142

Merged
merged 1 commit into from Apr 22, 2022

Conversation

code-ape
Copy link
Collaborator

@code-ape code-ape commented Apr 22, 2022

Previous this repo has imported Dialect objects via dynamically generating a string to require. This does not work well with compilers like ncc. To solve this and make for a better development experience we add the function getDialectByNameOrAlias to safely import Dialects while making requirement paths static for better compiler and bundler experiences.

Previous this repo has imported Dialect objects via dynamically generating
a string to require. This does not work well with compilers like ncc. To
solve this and make for a better development experience we add the function
`getDialectByNameOrAlias` to safely import Dialects while making requirement
paths static for better compiler and bundler experiences.
@@ -0,0 +1,35 @@
const { resolveClientNameWithAliases } = require('../util/helpers');

const dbNameToDialectLoader = Object.freeze({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why freeze it?

Copy link
Collaborator Author

@code-ape code-ape Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just trying to follow repo standards. I saw Object.freeze(...) was used for other constants. Happy to remove if preferred or change to all caps :)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 92.27% when pulling 477bfb4 on code-ape:PR/code-ape/better-client-import into 2511e74 on knex:master.

@kibertoad kibertoad merged commit 4e6a547 into knex:master Apr 22, 2022
@code-ape code-ape deleted the PR/code-ape/better-client-import branch April 22, 2022 15:09
@kibertoad
Copy link
Collaborator

Released in 2.1.0

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.

None yet

3 participants