Skip to content

Commit 12c6686

Browse files
committed
refactor: tweaks
1 parent 778579a commit 12c6686

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

packages/create-instance/create-instance.js

+7-10
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ import { validateSlots } from './validate-slots'
1717
import createScopedSlots from './create-scoped-slots'
1818
import { createStubsFromStubsObject } from './create-component-stubs'
1919
import { patchCreateElement } from './patch-create-element'
20-
import {
21-
isReservedTag,
22-
isConstructor,
23-
isDynamicComponent,
24-
isComponentOptions
25-
} from 'shared/validators'
20+
import { isConstructor } from 'shared/validators'
2621

2722
function vueExtendUnsupportedOption (option: string) {
2823
return `options.${option} is not supported for ` +
@@ -45,9 +40,6 @@ export default function createInstance (
4540
options: Options,
4641
_Vue: Component
4742
): Component {
48-
// make sure all extends are based on this instance
49-
_Vue.options._base = _Vue
50-
5143
if (
5244
VUE_VERSION < 2.3 && isConstructor(component)
5345
) {
@@ -78,7 +70,11 @@ export default function createInstance (
7870
patchCreateElement(_Vue, stubComponentsObject, options.shouldProxy)
7971

8072
if (componentOptions.functional) {
81-
componentOptions = createFunctionalComponent(componentOptions, options, _Vue)
73+
componentOptions = createFunctionalComponent(
74+
componentOptions,
75+
options,
76+
_Vue
77+
)
8278
} else if (options.context) {
8379
throwError(
8480
`mount.context can only be used when mounting a ` +
@@ -90,6 +86,7 @@ export default function createInstance (
9086
compileTemplate(componentOptions)
9187
}
9288

89+
// make sure all extends are based on this instance
9390
componentOptions._base = _Vue
9491

9592
const Constructor = _Vue.extend(componentOptions).extend(instanceOptions)

packages/create-instance/patch-create-element.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function patchCreateElement (_Vue, stubs, stubAllComponents) {
8484
}
8585

8686
if (typeof el === 'string') {
87-
let original = resolveComponent(el, originalComponents)
87+
const original = resolveComponent(el, originalComponents)
8888

8989
if (!original) {
9090
return originalCreateElement(el, ...args)

packages/test-utils/src/matches.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
COMPONENT_SELECTOR,
44
FUNCTIONAL_OPTIONS
55
} from 'shared/consts'
6-
import { isConstructor } from 'shared/validators';
6+
import { isConstructor } from 'shared/validators'
77

88
export function vmMatchesName (vm, name) {
99
return !!name && (

test/specs/mount.spec.js

+2
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'mount', () => {
408408
mount(TestComponent, {
409409
localVue
410410
})
411+
})
412+
411413
it('throws if component throws during update', () => {
412414
const TestComponent = {
413415
template: '<div :p="a" />',

0 commit comments

Comments
 (0)