work with esbuild and adjust tidb sql #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR did:
make it works with esbuild
see related issue: [bug] Can't work with sql-formatter-plus-plus lib evanw/esbuild#2181
I also tried to fix the upstream
regexpu-core
in PR require all unicode properties mathiasbynens/regexpu-core#61 and PR eliminate runtime require regexpu-core#1 , but foundsql-formatter-plus-plus
(aka https://github.com/TennyZhuang/sql-formatter-plus) only works withregexpu-core
4.7.0 , can't work with the latest 5.0.1 . After upgrading theregexpu-core
to the latest version,sql-formatter-plus-plus
can't pass the test. And when I checkout to 4.7.0, I found it can't pass its test without any changes.So I gave up fixing the upstream, just use a workaround, change the lib entry from
lib/sqlFormatter.js
to bundleddist/sql-formatter.js
ordist/sql-formatter.min.js
to skip the dynamic require issue.add TiDB Sql Formatter, this part of code is moved from tidb-dashboard codebase.
add unit test for TiDBSqlFormatter