@@ -140,6 +140,8 @@ export default class Block {
140
140
}
141
141
142
142
toString ( ) {
143
+ const { dev } = this . compiler . options ;
144
+
143
145
let introing ;
144
146
const hasIntros = ! this . builders . intro . isEmpty ( ) ;
145
147
if ( hasIntros ) {
@@ -177,10 +179,16 @@ export default class Block {
177
179
if ( this . builders . create . isEmpty ( ) && this . builders . hydrate . isEmpty ( ) ) {
178
180
properties . addBlock ( `c: @noop,` ) ;
179
181
} else {
182
+ const hydrate = ! this . builders . hydrate . isEmpty ( ) && (
183
+ this . compiler . options . hydratable
184
+ ? `this.h()`
185
+ : this . builders . hydrate
186
+ ) ;
187
+
180
188
properties . addBlock ( deindent `
181
- c: function create() {
189
+ ${ dev ? ' c: function create' : 'c' } () {
182
190
${ this . builders . create }
183
- ${ ! this . builders . hydrate . isEmpty ( ) && `this.h();` }
191
+ ${ hydrate }
184
192
},
185
193
` ) ;
186
194
}
@@ -190,17 +198,17 @@ export default class Block {
190
198
properties . addBlock ( `l: @noop,` ) ;
191
199
} else {
192
200
properties . addBlock ( deindent `
193
- l: function claim(nodes) {
201
+ ${ dev ? ' l: function claim' : 'l' } (nodes) {
194
202
${ this . builders . claim }
195
203
${ ! this . builders . hydrate . isEmpty ( ) && `this.h();` }
196
204
},
197
205
` ) ;
198
206
}
199
207
}
200
208
201
- if ( ! this . builders . hydrate . isEmpty ( ) ) {
209
+ if ( this . compiler . options . hydratable && ! this . builders . hydrate . isEmpty ( ) ) {
202
210
properties . addBlock ( deindent `
203
- h: function hydrate() {
211
+ ${ dev ? ' h: function hydrate' : 'h' } () {
204
212
${ this . builders . hydrate }
205
213
},
206
214
` ) ;
@@ -210,7 +218,7 @@ export default class Block {
210
218
properties . addBlock ( `m: @noop,` ) ;
211
219
} else {
212
220
properties . addBlock ( deindent `
213
- m: function mount(#target, anchor) {
221
+ ${ dev ? ' m: function mount' : 'm' } (#target, anchor) {
214
222
${ this . builders . mount }
215
223
},
216
224
` ) ;
@@ -221,7 +229,7 @@ export default class Block {
221
229
properties . addBlock ( `p: @noop,` ) ;
222
230
} else {
223
231
properties . addBlock ( deindent `
224
- p: function update(changed, ${ this . maintainContext ? '_ctx' : 'ctx' } ) {
232
+ ${ dev ? ' p: function update' : 'p' } (changed, ${ this . maintainContext ? '_ctx' : 'ctx' } ) {
225
233
${ this . maintainContext && `ctx = _ctx;` }
226
234
${ this . builders . update }
227
235
},
@@ -232,7 +240,7 @@ export default class Block {
232
240
if ( this . hasIntroMethod ) {
233
241
if ( hasIntros ) {
234
242
properties . addBlock ( deindent `
235
- i: function intro(#target, anchor) {
243
+ ${ dev ? ' i: function intro' : 'i' } (#target, anchor) {
236
244
if (${ introing } ) return;
237
245
${ introing } = true;
238
246
${ hasOutros && `${ outroing } = false;` }
@@ -244,7 +252,7 @@ export default class Block {
244
252
` ) ;
245
253
} else {
246
254
properties . addBlock ( deindent `
247
- i: function intro(#target, anchor) {
255
+ ${ dev ? ' i: function intro' : 'i' } (#target, anchor) {
248
256
this.m(#target, anchor);
249
257
},
250
258
` ) ;
@@ -254,7 +262,7 @@ export default class Block {
254
262
if ( this . hasOutroMethod ) {
255
263
if ( hasOutros ) {
256
264
properties . addBlock ( deindent `
257
- o: function outro(#outrocallback) {
265
+ ${ dev ? ' o: function outro' : 'o' } (#outrocallback) {
258
266
if (${ outroing } ) return;
259
267
${ outroing } = true;
260
268
${ hasIntros && `${ introing } = false;` }
@@ -275,7 +283,7 @@ export default class Block {
275
283
properties . addBlock ( `u: @noop,` ) ;
276
284
} else {
277
285
properties . addBlock ( deindent `
278
- u: function unmount() {
286
+ ${ dev ? ' u: function unmount' : 'u' } () {
279
287
${ this . builders . unmount }
280
288
},
281
289
` ) ;
@@ -285,7 +293,7 @@ export default class Block {
285
293
properties . addBlock ( `d: @noop` ) ;
286
294
} else {
287
295
properties . addBlock ( deindent `
288
- d: function destroy() {
296
+ ${ dev ? ' d: function destroy' : 'd' } () {
289
297
${ this . builders . destroy }
290
298
}
291
299
` ) ;
0 commit comments