I am trying to migrate some Vue.js Single File Components from ::v-deep syntax to :deep(), as described here. However, I am not sure how to make it work with nested SCSS rules with &__*. Rules without &__* work just fine.
The SCSS compiler we use is dart-sass.
Example
For example, having this original snippet:
::v-deep .wrapper {
    display: flex;
    &__element {
        display: block
    }
}
Correctly compiles the code to
[data-v-S0m3Ha5h] .wrapper__element {
    display: block;
}
And throws a warning: [@vue/compiler-sfc] ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.
:deep() in top-level rule
I have tried converting it to :deep() like this:
:deep(.wrapper) {
    display: flex;
    &__element {
        display: block
    }
}
which results in a compiler error, because :deep(wrapper)__element is not a valid selector.
:deep() in the nested rule
So I moved the :deep to the nested rule:
.wrapper {
    display: flex;
    :deep(&__element) {
        display: block
    }
}
which compiles without errors, but produces botched css:
.wrapper[data-v-S0m3Ha5h] &__element {/* ... */}
Question
How can I use nested &__* rules with :deep()?