( options: RendererOptions, createHydrationFns?: typeof createHydrationFunctions, )
| 345 | |
| 346 | // implementation |
| 347 | function baseCreateRenderer( |
| 348 | options: RendererOptions, |
| 349 | createHydrationFns?: typeof createHydrationFunctions, |
| 350 | ): any { |
| 351 | // compile-time feature flags check |
| 352 | if (__ESM_BUNDLER__ && !__TEST__) { |
| 353 | initFeatureFlags() |
| 354 | } |
| 355 | |
| 356 | const target = getGlobalThis() |
| 357 | target.__VUE__ = true |
| 358 | if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) { |
| 359 | setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target) |
| 360 | } |
| 361 | |
| 362 | const { |
| 363 | insert: hostInsert, |
| 364 | remove: hostRemove, |
| 365 | patchProp: hostPatchProp, |
| 366 | createElement: hostCreateElement, |
| 367 | createText: hostCreateText, |
| 368 | createComment: hostCreateComment, |
| 369 | setText: hostSetText, |
| 370 | setElementText: hostSetElementText, |
| 371 | parentNode: hostParentNode, |
| 372 | nextSibling: hostNextSibling, |
| 373 | setScopeId: hostSetScopeId = NOOP, |
| 374 | insertStaticContent: hostInsertStaticContent, |
| 375 | } = options |
| 376 | |
| 377 | // Note: functions inside this closure should use `const xxx = () => {}` |
| 378 | // style in order to prevent being inlined by minifiers. |
| 379 | const patch: PatchFn = ( |
| 380 | n1, |
| 381 | n2, |
| 382 | container, |
| 383 | anchor = null, |
| 384 | parentComponent = null, |
| 385 | parentSuspense = null, |
| 386 | namespace = undefined, |
| 387 | slotScopeIds = null, |
| 388 | optimized = __DEV__ && isHmrUpdating ? false : !!n2.dynamicChildren, |
| 389 | ) => { |
| 390 | if (n1 === n2) { |
| 391 | return |
| 392 | } |
| 393 | |
| 394 | // patching & not same type, unmount old tree |
| 395 | if (n1 && !isSameVNodeType(n1, n2)) { |
| 396 | anchor = getNextHostNode(n1) |
| 397 | unmount(n1, parentComponent, parentSuspense, true) |
| 398 | n1 = null |
| 399 | } |
| 400 | |
| 401 | if (n2.patchFlag === PatchFlags.BAIL) { |
| 402 | optimized = false |
| 403 | n2.dynamicChildren = null |
| 404 | } |
no test coverage detected