build(#10336): avoid intrinsic component names

This commit is contained in:
Acid Chicken (硫酸鶏)
2023-03-21 13:12:30 +09:00
parent 49f8bb4974
commit 5ced8aef27
112 changed files with 668 additions and 668 deletions

View File

@@ -90,7 +90,7 @@ function toStories(component: string): string {
<literal value={component.slice('src/'.length, -'.vue'.length)} />
) as unknown as estree.Literal;
const identifier = (
<identifier name={base.slice(0, -'.vue'.length).replace(/[-.]|^(?=\d)/g, '_')} />
<identifier name={base.slice(0, -'.vue'.length).replace(/[-.]|^(?=\d)/g, '_').replace(/(?<=^[^A-Z_]*$)/, '_')} />
) as unknown as estree.Identifier;
const parameters = (
<object-expression
@@ -262,7 +262,7 @@ function toStories(component: string): string {
/>,
<property
key={<identifier name='template' />}
value={<literal value={`<${identifier.name} v-bind='$props' />`} />}
value={<literal value={`<${identifier.name} v-bind="$props" />`} />}
kind={'init' as const}
/>,
]}