Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Revert "Add config class & Vue instance options (#90)"
Browse files Browse the repository at this point in the history
This reverts commit fe6038a.
  • Loading branch information
akxcv committed Sep 9, 2019
1 parent fe6038a commit d0acc55
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 92 deletions.
13 changes: 3 additions & 10 deletions dist/vuera.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,6 @@ var wrapReactChildren = function wrapReactChildren(createElement, children) {
});
};

var vueInstanceOptions = {};
var setVueInstanceOptions = function setVueInstanceOptions(opts) {
vueInstanceOptions = opts;
};

var VueContainer = function (_React$Component) {
inherits(VueContainer, _React$Component);

Expand Down Expand Up @@ -260,10 +255,9 @@ var VueContainer = function (_React$Component) {

// `this` refers to Vue instance in the constructor

reactThisBinding.vueInstance = new Vue(_extends({
reactThisBinding.vueInstance = new Vue({
el: targetElement,
data: props
}, vueInstanceOptions, {
data: props,
render: function render(createElement) {
return createElement(VUE_COMPONENT_NAME, {
props: this.$data,
Expand All @@ -272,7 +266,7 @@ var VueContainer = function (_React$Component) {
},

components: (_components = {}, defineProperty(_components, VUE_COMPONENT_NAME, component), defineProperty(_components, 'vuera-internal-react-wrapper', ReactWrapper), _components)
}));
});
}
}, {
key: 'updateVueComponent',
Expand Down Expand Up @@ -486,7 +480,6 @@ function babelReactResolver$$1(component, props, children) {
return isReactComponent(component) ? React.createElement(component, props, children) : React.createElement(VueContainer, Object.assign({ component: component }, props), children);
}

exports.setVueInstanceOptions = setVueInstanceOptions;
exports.ReactWrapper = ReactWrapper;
exports.VueWrapper = VueContainer;
exports.__vueraReactResolver = babelReactResolver$$1;
Expand Down
14 changes: 4 additions & 10 deletions dist/vuera.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ var wrapReactChildren = function wrapReactChildren(createElement, children) {
});
};

var vueInstanceOptions = {};
var setVueInstanceOptions = function setVueInstanceOptions(opts) {
vueInstanceOptions = opts;
};

var VueContainer = function (_React$Component) {
inherits(VueContainer, _React$Component);

Expand Down Expand Up @@ -254,10 +249,9 @@ var VueContainer = function (_React$Component) {

// `this` refers to Vue instance in the constructor

reactThisBinding.vueInstance = new Vue(_extends({
reactThisBinding.vueInstance = new Vue({
el: targetElement,
data: props
}, vueInstanceOptions, {
data: props,
render: function render(createElement) {
return createElement(VUE_COMPONENT_NAME, {
props: this.$data,
Expand All @@ -266,7 +260,7 @@ var VueContainer = function (_React$Component) {
},

components: (_components = {}, defineProperty(_components, VUE_COMPONENT_NAME, component), defineProperty(_components, 'vuera-internal-react-wrapper', ReactWrapper), _components)
}));
});
}
}, {
key: 'updateVueComponent',
Expand Down Expand Up @@ -480,4 +474,4 @@ function babelReactResolver$$1(component, props, children) {
return isReactComponent(component) ? React.createElement(component, props, children) : React.createElement(VueContainer, Object.assign({ component: component }, props), children);
}

export { setVueInstanceOptions, ReactWrapper, VueContainer as VueWrapper, babelReactResolver$$1 as __vueraReactResolver, VuePlugin, ReactResolver$$1 as VueInReact, VueResolver$$1 as ReactInVue };
export { ReactWrapper, VueContainer as VueWrapper, babelReactResolver$$1 as __vueraReactResolver, VuePlugin, ReactResolver$$1 as VueInReact, VueResolver$$1 as ReactInVue };
13 changes: 3 additions & 10 deletions dist/vuera.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ var wrapReactChildren = function wrapReactChildren(createElement, children) {
});
};

var vueInstanceOptions = {};
var setVueInstanceOptions = function setVueInstanceOptions(opts) {
vueInstanceOptions = opts;
};

var VueContainer = function (_React$Component) {
inherits(VueContainer, _React$Component);

Expand Down Expand Up @@ -257,10 +252,9 @@ var VueContainer = function (_React$Component) {

// `this` refers to Vue instance in the constructor

reactThisBinding.vueInstance = new Vue(_extends({
reactThisBinding.vueInstance = new Vue({
el: targetElement,
data: props
}, vueInstanceOptions, {
data: props,
render: function render(createElement) {
return createElement(VUE_COMPONENT_NAME, {
props: this.$data,
Expand All @@ -269,7 +263,7 @@ var VueContainer = function (_React$Component) {
},

components: (_components = {}, defineProperty(_components, VUE_COMPONENT_NAME, component), defineProperty(_components, 'vuera-internal-react-wrapper', ReactWrapper), _components)
}));
});
}
}, {
key: 'updateVueComponent',
Expand Down Expand Up @@ -483,7 +477,6 @@ function babelReactResolver$$1(component, props, children) {
return isReactComponent(component) ? React.createElement(component, props, children) : React.createElement(VueContainer, Object.assign({ component: component }, props), children);
}

exports.setVueInstanceOptions = setVueInstanceOptions;
exports.ReactWrapper = ReactWrapper;
exports.VueWrapper = VueContainer;
exports.__vueraReactResolver = babelReactResolver$$1;
Expand Down
7 changes: 0 additions & 7 deletions src/config.js

This file was deleted.

9 changes: 4 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import ReactWrapper from './wrappers/React'
import VueWrapper, { setVueInstanceOptions } from './wrappers/Vue'
import VueWrapper from './wrappers/Vue'
import VuePlugin from './VuePlugin'
import VueInReact, { babelReactResolver as __vueraReactResolver } from './resolvers/React'
import config from './config'
import VueInReact, {
babelReactResolver as __vueraReactResolver,
} from './resolvers/React'
import ReactInVue from './resolvers/Vue'

export {
setVueInstanceOptions,
ReactWrapper,
VueWrapper,
__vueraReactResolver,
VuePlugin,
VueInReact,
ReactInVue,
config,
}
2 changes: 0 additions & 2 deletions src/wrappers/Vue.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react'
import Vue from 'vue'
import ReactWrapper from './React'
import { config } from '../../src'

const VUE_COMPONENT_NAME = 'vuera-internal-component-name'

Expand Down Expand Up @@ -66,7 +65,6 @@ export default class VueContainer extends React.Component {
reactThisBinding.vueInstance = new Vue({
el: targetElement,
data: props,
...config.vueInstanceOptions,
render (createElement) {
return createElement(
VUE_COMPONENT_NAME,
Expand Down
7 changes: 0 additions & 7 deletions tests/config-test.js

This file was deleted.

23 changes: 0 additions & 23 deletions tests/fixtures/VueInstanceOptionsComponent.js

This file was deleted.

19 changes: 1 addition & 18 deletions tests/wrappers/VueWrapper-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Vue from 'vue'
import { VueWrapper, config } from '../../src'
import { VueWrapper } from '../../src'
import VueComponent from '../fixtures/VueComponent'
import VueInstanceOptionsComponent, { Plugin } from '../fixtures/VueInstanceOptionsComponent'
import VueRegisteredComponent from '../fixtures/VueRegisteredComponent'
import VueSingleFileComponent from '../fixtures/VueSingleFileComponent.vue'

Expand Down Expand Up @@ -207,19 +205,4 @@ describe('VueInReact', () => {
)
})
})

describe('config', () => {
afterEach(() => {
config.vueInstanceOptions = {}
})

it('adds vue instance options', () => {
Vue.use(Plugin)

config.vueInstanceOptions = { foo: 'New message!', bar: 'Other message' }
makeReactInstanceWithVueComponent(VueInstanceOptionsComponent)
expect(document.body.innerHTML).toContain('New message!')
expect(document.body.innerHTML).toContain('Other message')
})
})
})

0 comments on commit d0acc55

Please sign in to comment.