MCPcopy
hub / github.com/vuejs/core / applySingletonAppMutations

Function applySingletonAppMutations

packages/runtime-core/src/compat/global.ts:390–426  ·  view source on GitHub ↗
(app: App)

Source from the content-addressed store, hash-verified

388}
389
390function applySingletonAppMutations(app: App) {
391 // copy over asset registries and deopt flag
392 app._context.mixins = [...singletonApp._context.mixins]
393 ;['components', 'directives', 'filters'].forEach(key => {
394 // @ts-expect-error
395 app._context[key] = Object.create(singletonApp._context[key])
396 })
397
398 // copy over global config mutations
399 isCopyingConfig = true
400 for (const key in singletonApp.config) {
401 if (key === 'isNativeTag') continue
402 if (
403 isRuntimeOnly() &&
404 (key === 'isCustomElement' || key === 'compilerOptions')
405 ) {
406 continue
407 }
408 const val = singletonApp.config[key as keyof AppConfig]
409 // @ts-expect-error
410 app.config[key] = isObject(val) ? Object.create(val) : val
411
412 // compat for runtime ignoredElements -> isCustomElement
413 if (
414 key === 'ignoredElements' &&
415 isCompatEnabled(DeprecationTypes.CONFIG_IGNORED_ELEMENTS, null) &&
416 !isRuntimeOnly() &&
417 isArray(val)
418 ) {
419 app.config.compilerOptions.isCustomElement = tag => {
420 return val.some(v => (isString(v) ? v === tag : v.test(tag)))
421 }
422 }
423 }
424 isCopyingConfig = false
425 applySingletonPrototype(app, singletonCtor)
426}
427
428function applySingletonPrototype(app: App, Ctor: Function) {
429 // copy prototype augmentations as config.globalProperties

Callers 1

Calls 8

isRuntimeOnlyFunction · 0.90
isObjectFunction · 0.90
isCompatEnabledFunction · 0.90
isStringFunction · 0.90
applySingletonPrototypeFunction · 0.85
forEachMethod · 0.80
someMethod · 0.80
testMethod · 0.80

Tested by

no test coverage detected