-
-
Notifications
You must be signed in to change notification settings - Fork 172
feat: support generated JS imports for external scoped style #196
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
022fb1d
feat: support external scoped style
Jinjiang d6a2d80
test: add test cases for pre-compiled components
Jinjiang 70588fc
refactor: handle pre-compiled scoped styles
Jinjiang 411a12e
Merge branch 'main' into external-scoped-style
Jinjiang 31f3905
style: fix lint errors
haoqunjiang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import style0 from './external.module.css?module=true&lang.module.css' | ||
|
||
const __sfc__ = { | ||
data() { | ||
return { | ||
isRed: true, | ||
} | ||
}, | ||
} | ||
|
||
import { | ||
normalizeClass as _normalizeClass, | ||
createElementVNode as _createElementVNode, | ||
Fragment as _Fragment, | ||
openBlock as _openBlock, | ||
createElementBlock as _createElementBlock, | ||
} from 'vue' | ||
|
||
function render(_ctx, _cache, $props, $setup, $data, $options) { | ||
return ( | ||
_openBlock(), | ||
_createElementBlock( | ||
_Fragment, | ||
null, | ||
[ | ||
_createElementVNode( | ||
'p', | ||
{ | ||
class: _normalizeClass({ | ||
[_ctx.$style.red]: $data.isRed, | ||
'pre-compiled-external-cssmodules': true, | ||
}), | ||
}, | ||
' Am I red? ', | ||
2 /* CLASS */, | ||
), | ||
_createElementVNode( | ||
'p', | ||
{ | ||
class: _normalizeClass([ | ||
_ctx.$style.red, | ||
_ctx.$style.bold, | ||
'pre-compiled-external-cssmodules', | ||
]), | ||
}, | ||
' Red and bold ', | ||
2 /* CLASS */, | ||
), | ||
], | ||
64 /* STABLE_FRAGMENT */, | ||
) | ||
) | ||
} | ||
__sfc__.render = render | ||
const cssModules = {} | ||
cssModules['$style'] = style0 | ||
__sfc__.__cssModules = cssModules | ||
__sfc__.__file = 'external-cssmodules.vue' | ||
export default __sfc__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import './external.css?vue&type=style&scoped=true&id=0d49ede6&src=0d49ede6&lang.css' | ||
|
||
import { ref } from 'vue' | ||
const __sfc__ = { | ||
setup() { | ||
const msg = ref('Hello World!') | ||
return { msg } | ||
}, | ||
} | ||
|
||
import { | ||
toDisplayString as _toDisplayString, | ||
createElementVNode as _createElementVNode, | ||
vModelText as _vModelText, | ||
withDirectives as _withDirectives, | ||
Fragment as _Fragment, | ||
openBlock as _openBlock, | ||
createElementBlock as _createElementBlock, | ||
pushScopeId as _pushScopeId, | ||
popScopeId as _popScopeId, | ||
} from 'vue' | ||
|
||
const _withScopeId = (n) => ( | ||
_pushScopeId('data-v-0d49ede6'), (n = n()), _popScopeId(), n | ||
) | ||
const _hoisted_1 = { class: 'pre-compiled-external-scoped-title' } | ||
|
||
function render(_ctx, _cache, $props, $setup, $data, $options) { | ||
return ( | ||
_openBlock(), | ||
_createElementBlock( | ||
_Fragment, | ||
null, | ||
[ | ||
_createElementVNode( | ||
'h6', | ||
_hoisted_1, | ||
_toDisplayString($setup.msg), | ||
1 /* TEXT */, | ||
), | ||
_withDirectives( | ||
_createElementVNode( | ||
'input', | ||
{ | ||
'onUpdate:modelValue': | ||
_cache[0] || (_cache[0] = ($event) => ($setup.msg = $event)), | ||
}, | ||
null, | ||
512 /* NEED_PATCH */, | ||
), | ||
[[_vModelText, $setup.msg]], | ||
), | ||
], | ||
64 /* STABLE_FRAGMENT */, | ||
) | ||
) | ||
} | ||
__sfc__.render = render | ||
|
||
__sfc__.__scopeId = 'data-v-0d49ede6' | ||
__sfc__.__file = 'external-scoped.vue' | ||
export default __sfc__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.pre-compiled-external-scoped-title { | ||
color: red; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.red { | ||
color: red; | ||
} | ||
.bold { | ||
font-weight: bold; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import './foo.vue__0.css' | ||
|
||
import { ref } from 'vue' | ||
const __sfc__ = { | ||
setup() { | ||
const msg = ref('Hello World!') | ||
return { msg } | ||
}, | ||
} | ||
|
||
import { | ||
toDisplayString as _toDisplayString, | ||
createElementVNode as _createElementVNode, | ||
vModelText as _vModelText, | ||
withDirectives as _withDirectives, | ||
Fragment as _Fragment, | ||
openBlock as _openBlock, | ||
createElementBlock as _createElementBlock, | ||
} from 'vue' | ||
const _hoisted_1 = { class: 'pre-compiled-title' } | ||
|
||
function render(_ctx, _cache, $props, $setup, $data, $options) { | ||
return ( | ||
_openBlock(), | ||
_createElementBlock( | ||
_Fragment, | ||
null, | ||
[ | ||
_createElementVNode( | ||
'h6', | ||
_hoisted_1, | ||
_toDisplayString($setup.msg), | ||
1 /* TEXT */, | ||
), | ||
_withDirectives( | ||
_createElementVNode( | ||
'input', | ||
{ | ||
'onUpdate:modelValue': | ||
_cache[0] || (_cache[0] = ($event) => ($setup.msg = $event)), | ||
}, | ||
null, | ||
512 /* NEED_PATCH */, | ||
), | ||
[[_vModelText, $setup.msg]], | ||
), | ||
], | ||
64 /* STABLE_FRAGMENT */, | ||
) | ||
) | ||
} | ||
__sfc__.render = render | ||
|
||
__sfc__.__file = 'foo.vue' | ||
export default __sfc__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.pre-compiled-title { | ||
color: red; | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.