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

feat: support attr inherit #170

Merged
merged 7 commits into from
Jan 20, 2024
Merged

feat: support attr inherit #170

merged 7 commits into from
Jan 20, 2024

Conversation

wunci
Copy link
Collaborator

@wunci wunci commented Dec 16, 2023

src/ast/ts-ast-util.ts Show resolved Hide resolved
src/compilers/anode-compiler.ts Outdated Show resolved Hide resolved
src/compilers/anode-compiler.ts Outdated Show resolved Hide resolved
* @param attrs 上层透传接收的属性
* @param props 传递的props
*/
function deleteAttrByProps (attrs: string[], props: Record<string, number>) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议写成纯函数,返回一个新的数组

@@ -318,7 +318,7 @@ export class HelperCall implements SyntaxNode {
public readonly kind = SyntaxKind.HelperCall
constructor (
public name: 'styleFilter' | 'classFilter' | 'xstyleFilter' | 'xclassFilter' | 'attrFilter' | 'boolAttrFilter' |
'output' | 'escapeHTML',
'output' | 'escapeHTML' | 'deleteAttrByProps' | 'mergeAttr',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里没有删干净 'deleteAttrByProps' | 'mergeAttr'

@@ -16,6 +16,11 @@ export interface Context {
instance: any
}

interface NewAttr {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

干掉不用的 interface

src/parsers/typescript-san-parser.ts Show resolved Hide resolved
if (Object.keys(propsAttrAssign).length) {
rootAttrExec.push(...[
DEF('propsAttr', new MapLiteral(Object.keys(propsAttrAssign).map(name => [I(name), I('1')]))),
new Foreach(I('key'), I('val'), I('attrs'), [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需不需要考虑变量冲突问题?

@errorrik errorrik merged commit 221c90b into baidu:master Jan 20, 2024
github-actions bot pushed a commit that referenced this pull request Jan 23, 2024
# [3.14.0](nv3.13.3...nv3.14.0) (2024-01-23)

### Features

* support attr inherit ([#170](#170)) ([221c90b](221c90b))
* support attr inherit ([#171](#171)) ([5ddd882](5ddd882))
Copy link

🎉 This PR is included in version 3.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

wunci pushed a commit to wunci/san-ssr that referenced this pull request Jan 26, 2024
# [3.14.0](baidu/san-ssr@nv3.13.3...nv3.14.0) (2024-01-23)

### Features

* support attr inherit ([baidu#170](baidu#170)) ([221c90b](baidu@221c90b))
* support attr inherit ([baidu#171](baidu#171)) ([5ddd882](baidu@5ddd882))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants