-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
feat(compiler): compiler supports search tag #9249
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
Open
baiwusanyu-c
wants to merge
7
commits into
vuejs:minor
Choose a base branch
from
baiwusanyu-c:bwsy/feat/compilerSearchElm
base: minor
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
835fc82
chore: Synchronize the main branch code
baiwusanyu-c 5fe3299
chore: added getSetupReturnedHelper typo
baiwusanyu-c 912853f
chore: modify resolveSetupReturned typo
baiwusanyu-c b66dd91
Apply suggestions from code review
edison1105 bf3a41d
chore: More reasonable parameter design and transformation judgment
baiwusanyu-c db78752
chore: compatible with scenarios where values are taken from props
baiwusanyu-c 52369c2
chore: added unit test
baiwusanyu-c 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 |
---|---|---|
|
@@ -7,7 +7,7 @@ import { | |
} from '../component' | ||
import { currentRenderingInstance } from '../componentRenderContext' | ||
import type { Directive } from '../directives' | ||
import { camelize, capitalize, isString } from '@vue/shared' | ||
import { camelize, capitalize, isLateTag, isString } from '@vue/shared' | ||
import { warn } from '../warning' | ||
import type { VNodeTypes } from '../vnode' | ||
|
||
|
@@ -118,12 +118,21 @@ function resolveAsset( | |
return Component | ||
} | ||
|
||
if (__DEV__ && warnMissing && !res) { | ||
const extra = | ||
type === COMPONENTS | ||
? `\nIf this is a native custom element, make sure to exclude it from ` + | ||
if ( | ||
__DEV__ && | ||
warnMissing && | ||
((!res && !isLateTag(name)) || (res && isLateTag(name))) | ||
) { | ||
let extra = '' | ||
if (type === COMPONENTS) { | ||
if (isLateTag(name)) { | ||
extra = `\nplease do not use built-in tag names as component names.` | ||
} else { | ||
extra = | ||
`\nIf this is a native custom element, make sure to exclude it from ` + | ||
`component resolution via compilerOptions.isCustomElement.` | ||
: `` | ||
} | ||
} | ||
warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`) | ||
} | ||
|
||
|
@@ -144,3 +153,27 @@ function resolve(registry: Record<string, any> | undefined, name: string) { | |
registry[capitalize(camelize(name))]) | ||
) | ||
} | ||
|
||
/** | ||
* @private | ||
*/ | ||
export function resolveLateAddedTag( | ||
name: string, | ||
key: 'setupState' | 'props', | ||
): unknown { | ||
if (!currentRenderingInstance || !currentRenderingInstance[key]) return name | ||
const data = currentRenderingInstance[key] | ||
const value = data[name] | ||
// Only the render function for the value is parsed as a component | ||
// and a warning is reported | ||
if ( | ||
__DEV__ && | ||
value && | ||
(value as ComponentInternalInstance).render && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the 'setup script', the component value comes from the 'props' or 'setupState', and when it is an object with a render function, can it be considered a component? If it can be judged that it is a component in this way, then report a warning, otherwise leave it as is |
||
isLateTag(name as string) | ||
) { | ||
const extra = `\nplease do not use built-in tag names as component names.` | ||
warn(`Failed to resolve component: ${name},${extra}`) | ||
} | ||
return value | ||
} |
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
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.