Skip to content

Commit a1d18a3

Browse files
Alfred-Skybluesxzz
authored andcommitted
chore: replace Object.assign with extend
1 parent eb99101 commit a1d18a3

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

packages/compiler-sfc/src/compileScript.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from '@vue/compiler-dom'
77
import { DEFAULT_FILENAME, SFCDescriptor, SFCScriptBlock } from './parse'
88
import { ParserPlugin } from '@babel/parser'
9-
import { generateCodeFrame } from '@vue/shared'
9+
import { extend, generateCodeFrame } from '@vue/shared'
1010
import {
1111
Node,
1212
Declaration,
@@ -735,7 +735,7 @@ export function compileScript(
735735
// 7. analyze binding metadata
736736
// `defineProps` & `defineModel` also register props bindings
737737
if (scriptAst) {
738-
Object.assign(ctx.bindingMetadata, analyzeScriptBindings(scriptAst.body))
738+
extend(ctx.bindingMetadata, analyzeScriptBindings(scriptAst.body))
739739
}
740740
for (const [key, { isType, imported, source }] of Object.entries(
741741
ctx.userImports

packages/compiler-sfc/src/script/resolveType.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
} from './utils'
3535
import { ScriptCompileContext, resolveParserPlugins } from './context'
3636
import { ImportBinding, SFCScriptCompileOptions } from '../compileScript'
37-
import { capitalize, hasOwn } from '@vue/shared'
37+
import { capitalize, extend, hasOwn } from '@vue/shared'
3838
import { parse as babelParse } from '@babel/parser'
3939
import { parse } from '../parse'
4040
import { createCache } from '../cache'
@@ -1158,7 +1158,7 @@ function recordTypes(
11581158
scope,
11591159
stmt.source.value
11601160
)
1161-
Object.assign(scope.exportedTypes, sourceScope.exportedTypes)
1161+
extend(scope.exportedTypes, sourceScope.exportedTypes)
11621162
} else if (stmt.type === 'ExportDefaultDeclaration' && stmt.declaration) {
11631163
if (stmt.declaration.type !== 'Identifier') {
11641164
recordType(stmt.declaration, types, declares, 'default')

packages/runtime-core/src/compat/global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ function installCompatMount(
461461

462462
const hasNoRender =
463463
!isFunction(component) && !component.render && !component.template
464-
const emptyRender = NOOP
464+
const emptyRender = () => {}
465465

466466
// create root instance
467467
const instance = createComponentInstance(vnode, null, null)

packages/runtime-core/src/componentPublicInstance.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,7 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
381381
return desc.get.call(instance.proxy)
382382
} else {
383383
const val = globalProperties[key]
384-
return isFunction(val)
385-
? Object.assign(val.bind(instance.proxy), val)
386-
: val
384+
return isFunction(val) ? extend(val.bind(instance.proxy), val) : val
387385
}
388386
} else {
389387
return globalProperties[key]

packages/template-explorer/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { extend } from '@vue/shared'
12
import * as m from 'monaco-editor'
23
import { compile, CompilerError, CompilerOptions } from '@vue/compiler-dom'
34
import { compile as ssrCompile } from '@vue/compiler-ssr'
@@ -64,7 +65,7 @@ window.init = () => {
6465
// to debug with custom nodeTransforms
6566
delete persistedState.options?.nodeTransforms
6667
ssrMode.value = persistedState.ssr
67-
Object.assign(compilerOptions, persistedState.options)
68+
extend(compilerOptions, persistedState.options)
6869
}
6970

7071
let lastSuccessfulCode: string

packages/template-explorer/src/options.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { extend } from '@vue/shared'
12
import { h, reactive, createApp, ref } from 'vue'
23
import { CompilerOptions } from '@vue/compiler-dom'
34
import { BindingTypes } from '@vue/compiler-core'
@@ -27,7 +28,7 @@ export const defaultOptions: CompilerOptions = {
2728
}
2829

2930
export const compilerOptions: CompilerOptions = reactive(
30-
Object.assign({}, defaultOptions)
31+
extend({}, defaultOptions)
3132
)
3233

3334
const App = {

0 commit comments

Comments
 (0)