Skip to content

Commit 27632bb

Browse files
authored
refactor(compiler-vapor): remove redundant empty strings (#13993)
1 parent 3b5e13c commit 27632bb

File tree

8 files changed

+37
-37
lines changed

8 files changed

+37
-37
lines changed

packages/compiler-vapor/__tests__/transforms/__snapshots__/transformElement.spec.ts.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ exports[`compiler: element transform > component > static props 1`] = `
125125
export function render(_ctx) {
126126
const _component_Foo = _resolveComponent("Foo")
127127
const n0 = _createComponentWithFallback(_component_Foo, {
128-
id: () => ("foo"),
128+
id: () => ("foo"),
129129
class: () => ("bar")
130130
}, null, true)
131131
return n0
@@ -150,7 +150,7 @@ exports[`compiler: element transform > component > v-bind="obj" after static pro
150150
export function render(_ctx) {
151151
const _component_Foo = _resolveComponent("Foo")
152152
const n0 = _createComponentWithFallback(_component_Foo, {
153-
id: () => ("foo"),
153+
id: () => ("foo"),
154154
$: [
155155
() => (_ctx.obj)
156156
]
@@ -165,7 +165,7 @@ exports[`compiler: element transform > component > v-bind="obj" before static pr
165165
export function render(_ctx) {
166166
const _component_Foo = _resolveComponent("Foo")
167167
const n0 = _createComponentWithFallback(_component_Foo, { $: [
168-
() => (_ctx.obj),
168+
() => (_ctx.obj),
169169
{ id: () => ("foo") }
170170
] }, null, true)
171171
return n0
@@ -178,9 +178,9 @@ exports[`compiler: element transform > component > v-bind="obj" between static p
178178
export function render(_ctx) {
179179
const _component_Foo = _resolveComponent("Foo")
180180
const n0 = _createComponentWithFallback(_component_Foo, {
181-
id: () => ("foo"),
181+
id: () => ("foo"),
182182
$: [
183-
() => (_ctx.obj),
183+
() => (_ctx.obj),
184184
{ class: () => ("bar") }
185185
]
186186
}, null, true)
@@ -262,7 +262,7 @@ exports[`compiler: element transform > component with dynamic event arguments 1`
262262
export function render(_ctx) {
263263
const _component_Foo = _resolveComponent("Foo")
264264
const n0 = _createComponentWithFallback(_component_Foo, { $: [
265-
() => ({ [_toHandlerKey(_ctx.foo-_ctx.bar)]: () => _ctx.bar }),
265+
() => ({ [_toHandlerKey(_ctx.foo-_ctx.bar)]: () => _ctx.bar }),
266266
() => ({ [_toHandlerKey(_ctx.baz)]: () => _ctx.qux })
267267
] }, null, true)
268268
return n0
@@ -275,7 +275,7 @@ exports[`compiler: element transform > component with dynamic prop arguments 1`]
275275
export function render(_ctx) {
276276
const _component_Foo = _resolveComponent("Foo")
277277
const n0 = _createComponentWithFallback(_component_Foo, { $: [
278-
() => ({ [_ctx.foo-_ctx.bar]: _ctx.bar }),
278+
() => ({ [_ctx.foo-_ctx.bar]: _ctx.bar }),
279279
() => ({ [_ctx.baz]: _ctx.qux })
280280
] }, null, true)
281281
return n0

packages/compiler-vapor/__tests__/transforms/__snapshots__/transformSlotOutlet.spec.ts.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ exports[`compiler: transform <slot> outlets > default slot outlet with props 1`]
4040
4141
export function render(_ctx) {
4242
const n0 = _createSlot("default", {
43-
foo: () => ("bar"),
44-
baz: () => (_ctx.qux),
43+
foo: () => ("bar"),
44+
baz: () => (_ctx.qux),
4545
fooBar: () => (_ctx.foo-_ctx.bar)
4646
})
4747
return n0
@@ -125,7 +125,7 @@ exports[`compiler: transform <slot> outlets > statically named slot outlet with
125125
126126
export function render(_ctx) {
127127
const n0 = _createSlot("foo", {
128-
foo: () => ("bar"),
128+
foo: () => ("bar"),
129129
baz: () => (_ctx.qux)
130130
})
131131
return n0
@@ -137,9 +137,9 @@ exports[`compiler: transform <slot> outlets > statically named slot outlet with
137137
138138
export function render(_ctx) {
139139
const n0 = _createSlot("foo", {
140-
foo: () => ("bar"),
140+
foo: () => ("bar"),
141141
$: [
142-
() => (_ctx.obj),
142+
() => (_ctx.obj),
143143
{ baz: () => (_ctx.qux) }
144144
]
145145
})
@@ -152,9 +152,9 @@ exports[`compiler: transform <slot> outlets > statically named slot outlet with
152152
153153
export function render(_ctx) {
154154
const n0 = _createSlot("default", {
155-
onClick: () => _ctx.foo,
155+
onClick: () => _ctx.foo,
156156
$: [
157-
() => (_toHandlers(_ctx.bar)),
157+
() => (_toHandlers(_ctx.bar)),
158158
{ baz: () => (_ctx.qux) }
159159
]
160160
})

packages/compiler-vapor/__tests__/transforms/__snapshots__/vModel.spec.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function render(_ctx) {
3131
const n0 = _createComponentWithFallback(_component_Comp, {
3232
foo: () => (_ctx.foo),
3333
"onUpdate:foo": () => _value => (_ctx.foo = _value),
34-
fooModifiers: () => ({ trim: true }),
34+
fooModifiers: () => ({ trim: true }),
3535
bar: () => (_ctx.bar),
3636
"onUpdate:bar": () => _value => (_ctx.bar = _value),
3737
barModifiers: () => ({ number: true })
@@ -59,7 +59,7 @@ export function render(_ctx) {
5959
const n0 = _createComponentWithFallback(_component_Comp, { $: [
6060
() => ({ [_ctx.foo]: _ctx.foo,
6161
["onUpdate:" + _ctx.foo]: () => _value => (_ctx.foo = _value),
62-
[_ctx.foo + "Modifiers"]: () => ({ trim: true }) }),
62+
[_ctx.foo + "Modifiers"]: () => ({ trim: true }) }),
6363
() => ({ [_ctx.bar]: _ctx.bar,
6464
["onUpdate:" + _ctx.bar]: () => _value => (_ctx.bar = _value),
6565
[_ctx.bar + "Modifiers"]: () => ({ number: true }) })

packages/compiler-vapor/__tests__/transforms/__snapshots__/vOn.spec.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function render(_ctx) {
2020
const _on_update_model = () => {}
2121
const _on_update_model1 = () => {}
2222
const n0 = _createComponentWithFallback(_component_Foo, {
23-
"onUpdate:model": () => _on_update_model,
23+
"onUpdate:model": () => _on_update_model,
2424
"onUpdate-model": () => _on_update_model1
2525
}, null, true)
2626
return n0
@@ -333,7 +333,7 @@ const t0 = _template("<div></div>", true)
333333
export function render(_ctx) {
334334
const n0 = t0()
335335
_on(n0, "click", _withModifiers(e => _ctx.test(e), ["stop","prevent"]), {
336-
capture: true,
336+
capture: true,
337337
once: true
338338
})
339339
return n0

packages/compiler-vapor/__tests__/transforms/__snapshots__/vSlot.spec.ts.snap

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function render(_ctx) {
99
const n2 = _createComponentWithFallback(_component_Comp, null, {
1010
$: [
1111
() => ({
12-
name: _ctx.name,
12+
name: _ctx.name,
1313
fn: () => {
1414
const n0 = t0()
1515
return n0
@@ -30,7 +30,7 @@ export function render(_ctx) {
3030
const n2 = _createComponentWithFallback(_component_Comp, null, {
3131
$: [
3232
() => (_createForSlots(_ctx.list, (item) => ({
33-
name: item,
33+
name: item,
3434
fn: (_slotProps0) => {
3535
const n0 = t0()
3636
_renderEffect(() => _setText(n0, _toDisplayString(_slotProps0["bar"])))
@@ -52,7 +52,7 @@ export function render(_ctx) {
5252
const n2 = _createComponentWithFallback(_component_Comp, null, {
5353
$: [
5454
() => (_createForSlots(_ctx.list, (_, __, index) => ({
55-
name: index,
55+
name: index,
5656
fn: () => {
5757
const n0 = t0()
5858
return n0
@@ -76,22 +76,22 @@ export function render(_ctx) {
7676
$: [
7777
() => (_ctx.condition
7878
? {
79-
name: "condition",
79+
name: "condition",
8080
fn: () => {
8181
const n0 = t0()
8282
return n0
8383
}
8484
}
8585
: _ctx.anotherCondition
8686
? {
87-
name: "condition",
87+
name: "condition",
8888
fn: (_slotProps0) => {
8989
const n2 = t1()
9090
return n2
9191
}
9292
}
9393
: {
94-
name: "condition",
94+
name: "condition",
9595
fn: () => {
9696
const n4 = t2()
9797
return n4
@@ -131,7 +131,7 @@ export function render(_ctx) {
131131
"one": () => {
132132
const n0 = t0()
133133
return n0
134-
},
134+
},
135135
"default": () => {
136136
const n2 = t1()
137137
const n3 = t2()
@@ -192,7 +192,7 @@ export function render(_ctx) {
192192
const n1 = _createComponentWithFallback(_component_Comp, null, {
193193
$: [
194194
() => ({
195-
name: _ctx.named,
195+
name: _ctx.named,
196196
fn: (_slotProps0) => {
197197
const n0 = t0()
198198
_renderEffect(() => _setText(n0, _toDisplayString(_slotProps0["foo"] + _ctx.bar)))
@@ -287,7 +287,7 @@ export function render(_ctx) {
287287
"header": () => {
288288
const n0 = t0()
289289
return n0
290-
},
290+
},
291291
"default": () => {
292292
const n2 = t1()
293293
const n3 = t2()
@@ -309,7 +309,7 @@ export function render(_ctx) {
309309
"header": () => {
310310
const n0 = t0()
311311
return n0
312-
},
312+
},
313313
"default": () => {
314314
const n3 = t1()
315315
return n3
@@ -330,7 +330,7 @@ export function render(_ctx) {
330330
"header": () => {
331331
const n0 = t0()
332332
return n0
333-
},
333+
},
334334
"footer": () => {
335335
const n3 = t1()
336336
return n3

packages/compiler-vapor/__tests__/transforms/transformElement.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ describe('compiler: element transform', () => {
194194

195195
expect(code).toMatchSnapshot()
196196
expect(code).contains(`{
197-
id: () => ("foo"),
197+
id: () => ("foo"),
198198
class: () => ("bar")
199199
}`)
200200

@@ -262,7 +262,7 @@ describe('compiler: element transform', () => {
262262
)
263263
expect(code).toMatchSnapshot()
264264
expect(code).contains(`{
265-
id: () => ("foo"),
265+
id: () => ("foo"),
266266
$: [
267267
() => (_ctx.obj)
268268
]
@@ -286,7 +286,7 @@ describe('compiler: element transform', () => {
286286
)
287287
expect(code).toMatchSnapshot()
288288
expect(code).contains(`[
289-
() => (_ctx.obj),
289+
() => (_ctx.obj),
290290
{ id: () => ("foo") }
291291
]`)
292292
expect(ir.block.dynamic.children[0].operation).toMatchObject({
@@ -308,9 +308,9 @@ describe('compiler: element transform', () => {
308308
)
309309
expect(code).toMatchSnapshot()
310310
expect(code).contains(`{
311-
id: () => ("foo"),
311+
id: () => ("foo"),
312312
$: [
313-
() => (_ctx.obj),
313+
() => (_ctx.obj),
314314
{ class: () => ("bar") }
315315
]
316316
}`)

packages/compiler-vapor/__tests__/transforms/vOn.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ describe('v-on', () => {
415415
])
416416
expect(code).contains(
417417
`_on(n0, "click", _withModifiers(e => _ctx.test(e), ["stop","prevent"]), {
418-
capture: true,
418+
capture: true,
419419
once: true
420420
})`,
421421
)

packages/compiler-vapor/src/generators/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ export const DELIMITERS_ARRAY: CodeFragmentDelimiters = ['[', ']', ', ']
7979
export const DELIMITERS_ARRAY_NEWLINE: CodeFragmentDelimiters = [
8080
['[', INDENT_START, NEWLINE],
8181
[INDENT_END, NEWLINE, ']'],
82-
[', ', NEWLINE],
82+
[',', NEWLINE],
8383
]
8484
export const DELIMITERS_OBJECT: CodeFragmentDelimiters = ['{ ', ' }', ', ']
8585
export const DELIMITERS_OBJECT_NEWLINE: CodeFragmentDelimiters = [
8686
['{', INDENT_START, NEWLINE],
8787
[INDENT_END, NEWLINE, '}'],
88-
[', ', NEWLINE],
88+
[',', NEWLINE],
8989
]
9090

9191
export function genCall(

0 commit comments

Comments
 (0)