@@ -15,9 +15,6 @@ import {
15
15
type VNodeChild
16
16
} from 'vue'
17
17
18
- // @ts -ignore
19
- const DEV = process . env . NODE_ENV !== 'production'
20
-
21
18
export const isComment = ( vnode : unknown ) : vnode is ( null | undefined | boolean | ( VNode & { type : typeof CommentVNode } ) ) => {
22
19
return getType ( vnode ) === 'comment'
23
20
}
@@ -157,7 +154,7 @@ const getFragmentChildren = (fragmentVNode: VNode | VNodeArrayChildren): VNodeAr
157
154
return children
158
155
}
159
156
160
- if ( DEV ) {
157
+ if ( __DEV__ ) {
161
158
warn ( 'getFragmentChildren' , `Unknown children for fragment: ${ typeOf ( children ) } ` )
162
159
}
163
160
@@ -174,7 +171,7 @@ export type IterationOptions = {
174
171
175
172
// esbuild can remove an identity function, so long as it uses a function declaration
176
173
function freeze < T > ( obj : T ) : T {
177
- if ( DEV ) {
174
+ if ( __DEV__ ) {
178
175
return Object . freeze ( obj )
179
176
}
180
177
@@ -225,14 +222,14 @@ export const addProps = (
225
222
callback : ( vnode : VNode ) => ( Record < string , unknown > | null | void ) ,
226
223
options : IterationOptions = COMPONENTS_AND_ELEMENTS
227
224
) : VNodeArrayChildren => {
228
- if ( DEV ) {
225
+ if ( __DEV__ ) {
229
226
checkArguments ( 'addProps' , [ children , callback , options ] , [ 'array' , 'function' , 'object' ] )
230
227
}
231
228
232
229
return replaceChildrenInternal ( children , ( vnode ) => {
233
230
const props = callback ( vnode )
234
231
235
- if ( DEV ) {
232
+ if ( __DEV__ ) {
236
233
const typeofProps = typeOf ( props )
237
234
238
235
if ( ! [ 'object' , 'null' , 'undefined' ] . includes ( typeofProps ) ) {
@@ -251,7 +248,7 @@ export const replaceChildren = (
251
248
callback : ( vnode : VNode ) => ( VNode | VNodeArrayChildren | string | number | void ) ,
252
249
options : IterationOptions = SKIP_COMMENTS
253
250
) : VNodeArrayChildren => {
254
- if ( DEV ) {
251
+ if ( __DEV__ ) {
255
252
checkArguments ( 'replaceChildren' , [ children , callback , options ] , [ 'array' , 'function' , 'object' ] )
256
253
}
257
254
@@ -293,7 +290,7 @@ const replaceChildrenInternal = (
293
290
if ( vnode ) {
294
291
const newNodes = callback ( vnode ) ?? vnode
295
292
296
- if ( DEV ) {
293
+ if ( __DEV__ ) {
297
294
const typeOfNewNodes = typeOf ( newNodes )
298
295
299
296
if ( ! [ 'array' , 'vnode' , 'string' , 'number' , 'undefined' ] . includes ( typeOfNewNodes ) ) {
@@ -324,7 +321,7 @@ export const betweenChildren = (
324
321
callback : ( previousVNode : VNode , nextVNode : VNode ) => ( VNode | VNodeArrayChildren | string | number | void ) ,
325
322
options : IterationOptions = SKIP_COMMENTS
326
323
) : VNodeArrayChildren => {
327
- if ( DEV ) {
324
+ if ( __DEV__ ) {
328
325
checkArguments ( 'betweenChildren' , [ children , callback , options ] , [ 'array' , 'function' , 'object' ] )
329
326
}
330
327
@@ -336,7 +333,7 @@ export const betweenChildren = (
336
333
if ( previousVNode ) {
337
334
insertedNodes = callback ( previousVNode , vnode )
338
335
339
- if ( DEV ) {
336
+ if ( __DEV__ ) {
340
337
const typeOfInsertedNodes = typeOf ( insertedNodes )
341
338
342
339
if ( ! [ 'array' , 'vnode' , 'string' , 'number' , 'undefined' ] . includes ( typeOfInsertedNodes ) ) {
@@ -364,7 +361,7 @@ export const someChild = (
364
361
callback : ( vnode : VNode ) => unknown ,
365
362
options : IterationOptions = ALL_VNODES
366
363
) : boolean => {
367
- if ( DEV ) {
364
+ if ( __DEV__ ) {
368
365
checkArguments ( 'someChild' , [ children , callback , options ] , [ 'array' , 'function' , 'object' ] )
369
366
}
370
367
@@ -398,7 +395,7 @@ export const everyChild = (
398
395
callback : ( vnode : VNode ) => unknown ,
399
396
options : IterationOptions = ALL_VNODES
400
397
) : boolean => {
401
- if ( DEV ) {
398
+ if ( __DEV__ ) {
402
399
checkArguments ( 'everyChild' , [ children , callback , options ] , [ 'array' , 'function' , 'object' ] )
403
400
}
404
401
@@ -410,7 +407,7 @@ export const eachChild = (
410
407
callback : ( vnode : VNode ) => void ,
411
408
options : IterationOptions = ALL_VNODES
412
409
) : void => {
413
- if ( DEV ) {
410
+ if ( __DEV__ ) {
414
411
checkArguments ( 'eachChild' , [ children , callback , options ] , [ 'array' , 'function' , 'object' ] )
415
412
}
416
413
@@ -424,7 +421,7 @@ export const findChild = (
424
421
callback : ( vnode : VNode ) => unknown ,
425
422
options : IterationOptions = ALL_VNODES
426
423
) : ( VNode | undefined ) => {
427
- if ( DEV ) {
424
+ if ( __DEV__ ) {
428
425
checkArguments ( 'findChild' , [ children , callback , options ] , [ 'array' , 'function' , 'object' ] )
429
426
}
430
427
@@ -443,7 +440,7 @@ export const findChild = (
443
440
const COLLAPSIBLE_WHITESPACE_RE = / \S | \u00a0 /
444
441
445
442
export const isEmpty = ( children : VNodeArrayChildren ) : boolean => {
446
- if ( DEV ) {
443
+ if ( __DEV__ ) {
447
444
checkArguments ( 'isEmpty' , [ children ] , [ 'array' ] )
448
445
}
449
446
@@ -459,15 +456,15 @@ export const isEmpty = (children: VNodeArrayChildren): boolean => {
459
456
}
460
457
461
458
export const extractSingleChild = ( children : VNodeArrayChildren ) : VNode | undefined => {
462
- if ( DEV ) {
459
+ if ( __DEV__ ) {
463
460
checkArguments ( 'extractSingleChild' , [ children ] , [ 'array' ] )
464
461
}
465
462
466
463
const node = findChild ( children , ( ) => {
467
464
return true
468
465
} , COMPONENTS_AND_ELEMENTS )
469
466
470
- if ( DEV ) {
467
+ if ( __DEV__ ) {
471
468
someChildInternal ( children , ( vnode ) => {
472
469
let warning = ''
473
470
0 commit comments