Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0662d17

Browse files
committed
fix: should not throw when root property not found
1 parent622e53b commit0662d17

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

‎transformations/__tests__/root-prop-to-use-test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,12 @@ defineInlineTest(
2020
`Vue.createApp({}).use(router);`,
2121
'Can recognize Vue.createApp'
2222
)
23+
24+
defineInlineTest(
25+
transform,
26+
{
27+
rootPropName:'router',
28+
},
29+
`createApp({});`,
30+
`createApp({});`
31+
)

‎transformations/root-prop-to-use.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ export const transformAST: ASTTransformation<Params> = (
4242
//@ts-ignore
4343
(p)=>p.key&&p.key.name===rootPropName
4444
)
45+
46+
if(propertyIndex===-1){
47+
returncreateAppCall
48+
}
49+
4550
//@ts-ignore
4651
const[{value:pluginInstance}]=rootProps.properties.splice(
4752
propertyIndex,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp