Skip to content

Commit efe0488

Browse files
authored
Merge pull request #363 from nogic1008/next
build: merge 'next' (Vue 3) branch into 'master' (Vue 2) for monorepo
2 parents 4dd33a2 + a75242e commit efe0488

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3181
-19
lines changed

Diff for: .circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
key: node-10-dependencies-{{ checksum "package.json" }}
2525

2626
# run tests!
27-
- run: npm run test
27+
- run: yarn test

Diff for: e2e/3.x/babel-in-package/components/Basic.vue

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<div class="hello">
3+
<h1 :class="headingClasses">{{ msg }}</h1>
4+
</div>
5+
</template>
6+
7+
<style module="css">
8+
.testA {
9+
background-color: red;
10+
}
11+
</style>
12+
<style module>
13+
.testB {
14+
background-color: blue;
15+
}
16+
</style>
17+
<style>
18+
.testC {
19+
background-color: blue;
20+
}
21+
</style>
22+
23+
<script>
24+
export default {
25+
name: 'basic',
26+
computed: {
27+
headingClasses: function headingClasses() {
28+
return {
29+
red: this.isCrazy,
30+
blue: !this.isCrazy,
31+
shadow: this.isCrazy
32+
}
33+
}
34+
},
35+
data: function data() {
36+
return {
37+
msg: 'Welcome to Your Vue.js App',
38+
isCrazy: false
39+
}
40+
},
41+
methods: {
42+
toggleClass: function toggleClass() {
43+
this.isCrazy = !this.isCrazy
44+
}
45+
}
46+
}
47+
</script>

Diff for: e2e/3.x/babel-in-package/components/Coffee.vue

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<h1>Coffee</h1>
3+
</template>
4+
5+
<script lang="coffee">
6+
export default
7+
name: 'coffee'
8+
data: -> {}
9+
</script>

Diff for: e2e/3.x/babel-in-package/components/TypeScript.vue

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<template>
2+
<div>
3+
<div id="parent">
4+
{{ exclamationMarks }}
5+
</div>
6+
<type-script-child />
7+
</div>
8+
</template>
9+
10+
<script lang="ts">
11+
import TypeScriptChild from './TypeScriptChild.vue'
12+
export default {
13+
computed: {
14+
exclamationMarks(): string {
15+
return 'Parent'
16+
}
17+
},
18+
components: {
19+
TypeScriptChild
20+
}
21+
}
22+
</script>
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<template>
2+
<div id="child">{{ exclamationMarks }}</div>
3+
</template>
4+
5+
<script lang="ts">
6+
export default {
7+
computed: {
8+
exclamationMarks(): string {
9+
return 'Child'
10+
}
11+
}
12+
}
13+
</script>

Diff for: e2e/3.x/babel-in-package/package.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "vue3-babel-in-package",
3+
"version": "1.0.0",
4+
"license": "MIT",
5+
"private": true,
6+
"scripts": {
7+
"test": "jest --no-cache test.js"
8+
},
9+
"dependencies": {
10+
"vue": "^3.0.3"
11+
},
12+
"devDependencies": {
13+
"@babel/core": "^7.9.0",
14+
"@babel/preset-env": "^7.9.0",
15+
"@vue/compiler-sfc": "^3.0.3",
16+
"coffeescript": "^2.3.2",
17+
"jest": "^26.0.0",
18+
"ts-jest": "^26.4.4",
19+
"typescript": "^4.1.2",
20+
"vue3-jest": "^26.0.0-alpha.10"
21+
},
22+
"jest": {
23+
"moduleFileExtensions": [
24+
"js",
25+
"json",
26+
"vue"
27+
],
28+
"transform": {
29+
"^.+\\.js$": "babel-jest",
30+
"^.+\\.vue$": "vue3-jest"
31+
}
32+
},
33+
"babel": {
34+
"presets": [
35+
"@babel/env"
36+
]
37+
}
38+
}

Diff for: e2e/3.x/babel-in-package/test.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { createApp, h } from 'vue'
2+
3+
import TypeScript from './components/TypeScript.vue'
4+
import Basic from './components/Basic.vue'
5+
import Coffee from './components/Coffee.vue'
6+
7+
function mount(Component, props, slots) {
8+
document.getElementsByTagName('html')[0].innerHTML = ''
9+
const el = document.createElement('div')
10+
el.id = 'app'
11+
document.body.appendChild(el)
12+
const Parent = {
13+
render() {
14+
return h(Component, props, slots)
15+
}
16+
}
17+
createApp(Parent).mount(el)
18+
}
19+
20+
test('processes .vue files', () => {
21+
mount(Basic)
22+
expect(document.querySelector('h1').textContent).toBe(
23+
'Welcome to Your Vue.js App'
24+
)
25+
})
26+
27+
test('processes .vue file with lang set to coffee', () => {
28+
mount(Coffee)
29+
expect(document.querySelector('h1').textContent).toBe('Coffee')
30+
})
31+
32+
test('processes .vue files with lang set to typescript', () => {
33+
mount(TypeScript)
34+
expect(document.querySelector('#parent').textContent).toBe('Parent')
35+
expect(document.querySelector('#child').textContent).toBe('Child')
36+
})

Diff for: e2e/3.x/babel-in-package/tsconfig.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2017",
4+
"lib": ["dom", "es6"],
5+
"module": "ES2015",
6+
"moduleResolution": "node",
7+
"types": ["vue-typescript-import-dts", "node"],
8+
"isolatedModules": false,
9+
"experimentalDecorators": true,
10+
"noImplicitAny": true,
11+
"noImplicitThis": true,
12+
"strictNullChecks": true,
13+
"removeComments": true,
14+
"emitDecoratorMetadata": true,
15+
"suppressImplicitAnyIndexErrors": true,
16+
"allowSyntheticDefaultImports": true,
17+
"sourceMap": true
18+
}
19+
}

Diff for: e2e/3.x/basic/__snapshots__/test.js.snap

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`generates source maps for .vue files 1`] = `
4+
"\\"use strict\\";
5+
6+
Object.defineProperty(exports, \\"__esModule\\", {
7+
value: true
8+
});
9+
exports[\\"default\\"] = void 0;
10+
var _default = {
11+
name: 'basic',
12+
computed: {
13+
headingClasses: function headingClasses() {
14+
return {
15+
red: this.isCrazy,
16+
blue: !this.isCrazy,
17+
shadow: this.isCrazy
18+
};
19+
}
20+
},
21+
data: function data() {
22+
return {
23+
msg: 'Welcome to Your Vue.js App',
24+
isCrazy: false
25+
};
26+
},
27+
methods: {
28+
toggleClass: function toggleClass() {
29+
this.isCrazy = !this.isCrazy;
30+
}
31+
}
32+
};
33+
exports[\\"default\\"] = _default;
34+
\\"use strict\\";
35+
Object.defineProperty(exports, \\"__esModule\\", { value: true });
36+
exports.render = void 0;
37+
var vue_1 = require(\\"vue\\");
38+
var _hoisted_1 = { class: \\"hello\\" };
39+
function render(_ctx, _cache) {
40+
return (vue_1.openBlock(), vue_1.createBlock(\\"div\\", _hoisted_1, [
41+
vue_1.createVNode(\\"h1\\", { class: _ctx.headingClasses }, vue_1.toDisplayString(_ctx.msg), 3 /* TEXT, CLASS */)
42+
]));
43+
}
44+
exports.render = render;
45+
;exports.default = {...exports.default, render};;exports.default = {...exports.default, __cssModules: {\\"css\\":{\\"testA\\":\\"testA\\"},\\"$style\\":{\\"testB\\":\\"testB\\"}}}"
46+
`;
47+
48+
exports[`generates source maps using src attributes 1`] = `
49+
"\\"use strict\\";
50+
51+
Object.defineProperty(exports, \\"__esModule\\", {
52+
value: true
53+
});
54+
exports[\\"default\\"] = void 0;
55+
var _default = {
56+
name: 'basic',
57+
computed: {
58+
headingClasses: function headingClasses() {
59+
return {
60+
red: this.isCrazy,
61+
blue: !this.isCrazy,
62+
shadow: this.isCrazy
63+
};
64+
}
65+
},
66+
data: function data() {
67+
return {
68+
msg: 'Welcome to Your Vue.js App',
69+
isCrazy: false
70+
};
71+
},
72+
methods: {
73+
toggleClass: function toggleClass() {
74+
this.isCrazy = !this.isCrazy;
75+
}
76+
}
77+
};
78+
exports[\\"default\\"] = _default;
79+
\\"use strict\\";
80+
Object.defineProperty(exports, \\"__esModule\\", { value: true });
81+
exports.render = void 0;
82+
var vue_1 = require(\\"vue\\");
83+
var _hoisted_1 = { class: \\"hello\\" };
84+
function render(_ctx, _cache) {
85+
return (vue_1.openBlock(), vue_1.createBlock(\\"div\\", _hoisted_1, [
86+
vue_1.createVNode(\\"h1\\", { class: _ctx.headingClasses }, vue_1.toDisplayString(_ctx.msg), 3 /* TEXT, CLASS */)
87+
]));
88+
}
89+
exports.render = render;
90+
;exports.default = {...exports.default, render};"
91+
`;

Diff for: e2e/3.x/basic/babel.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
presets: ['@babel/preset-env'],
3+
plugins: ['transform-vue-jsx']
4+
}

Diff for: e2e/3.x/basic/components/Basic.vue

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<div class="hello">
3+
<h1 :class="headingClasses">{{ msg }}</h1>
4+
</div>
5+
</template>
6+
7+
<style module="css">
8+
.testA {
9+
background-color: red;
10+
}
11+
</style>
12+
<style module>
13+
.testB {
14+
background-color: blue;
15+
}
16+
</style>
17+
<style>
18+
.testC {
19+
background-color: blue;
20+
}
21+
</style>
22+
23+
<script>
24+
export default {
25+
name: 'basic',
26+
computed: {
27+
headingClasses: function headingClasses() {
28+
return {
29+
red: this.isCrazy,
30+
blue: !this.isCrazy,
31+
shadow: this.isCrazy
32+
}
33+
}
34+
},
35+
data: function data() {
36+
return {
37+
msg: 'Welcome to Your Vue.js App',
38+
isCrazy: false
39+
}
40+
},
41+
methods: {
42+
toggleClass: function toggleClass() {
43+
this.isCrazy = !this.isCrazy
44+
}
45+
}
46+
}
47+
</script>

Diff for: e2e/3.x/basic/components/BasicSrc.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="hello">
2+
<h1 :class="headingClasses">{{ msg }}</h1>
3+
</div>

Diff for: e2e/3.x/basic/components/BasicSrc.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export default {
2+
name: 'basic',
3+
computed: {
4+
headingClasses: function headingClasses() {
5+
return {
6+
red: this.isCrazy,
7+
blue: !this.isCrazy,
8+
shadow: this.isCrazy
9+
}
10+
}
11+
},
12+
data: function data() {
13+
return {
14+
msg: 'Welcome to Your Vue.js App',
15+
isCrazy: false
16+
}
17+
},
18+
methods: {
19+
toggleClass: function toggleClass() {
20+
this.isCrazy = !this.isCrazy
21+
}
22+
}
23+
}

Diff for: e2e/3.x/basic/components/BasicSrc.vue

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template src="./BasicSrc.html"></template>
2+
3+
<script src="./BasicSrc.js"></script>

0 commit comments

Comments
 (0)