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(cli): type imports in swizzle command #6039

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

aliemir
Copy link
Member

@aliemir aliemir commented Jun 12, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

Changes

When exporting elements with swizzle command, it will try to replace and combine imports from Refine packages. This process was broken if the target file was using import type syntax. This PR updates swizzle command to handle import type syntax separately.

Resolves #6035

@aliemir aliemir requested a review from a team as a code owner June 12, 2024 08:21
Copy link

changeset-bot bot commented Jun 12, 2024

🦋 Changeset detected

Latest commit: 1227c96

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@refinedev/cli Patch
@refinedev/devtools Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -1,5 +1,5 @@
const packageRegex =
/import(?:(?:(?:[ \n\t]+([^ *\n\t\{\},]+)[ \n\t]*(?:,|[ \n\t]+))?([ \n\t]*\{(?:[ \n\t]*[^ \n\t"'\{\}]+[ \n\t]*,?)+\})?[ \n\t]*)|[ \n\t]*\*[ \n\t]*as[ \n\t]+([^ \n\t\{\}]+)[ \n\t]+)from[ \n\t]*(?:['"])([^'"\n]+)(?:['"])(?:;?)/g;
/import(?:\s{1}type)?(?:(?:(?:[ \n\t]+([^ *\n\t\{\},]+)[ \n\t]*(?:,|[ \n\t]+))?([ \n\t]*\{(?:[ \n\t]*[^ \n\t"'\{\}]+[ \n\t]*,?)+\})?[ \n\t]*)|[ \n\t]*\*[ \n\t]*as[ \n\t]+([^ \n\t\{\}]+)[ \n\t]+)from[ \n\t]*(?:['"])([^'"\n]+)(?:['"])(?:;?)/g;

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with 'import{{' and containing many repetitions of '!'.
Copy link

cypress bot commented Jun 12, 2024

Passing run #11195 ↗︎

0 379 37 0 Flakiness 0

Details:

Merge 1227c96 into a985034...
Project: refine Commit: 0479045579 ℹ️
Status: Passed Duration: 20:44 💡
Started: Jun 12, 2024 11:55 AM Ended: Jun 12, 2024 12:16 PM

Review all test suite changes for PR #6039 ↗︎

@BatuhanW BatuhanW added this to the July Release milestone Jun 12, 2024
@BatuhanW BatuhanW changed the base branch from master to releases/july June 20, 2024 08:47
@BatuhanW BatuhanW merged commit 24db047 into releases/july Jun 20, 2024
96 checks passed
@BatuhanW BatuhanW deleted the fix/type-imports-in-swizzle branch June 20, 2024 08:49
@BatuhanW BatuhanW mentioned this pull request Jun 20, 2024
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.

[BUG] corrupted data-rpvider code when npm run refine swizzle
2 participants