Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2e9f83d

Browse filesBrowse files
committed
Merge branch 'dev'
2 parents 29bc555 + 27149ca commit 2e9f83d
Copy full SHA for 2e9f83d

File tree

Expand file treeCollapse file tree

13 files changed

+103
-31
lines changed
Filter options
Expand file treeCollapse file tree

13 files changed

+103
-31
lines changed

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# [1.0.0](https://github.com/vuejs/jsx/compare/v1.0.0-beta.3...v1.0.0) (2019-05-08)
2+
3+
## other
4+
5+
#### Bug Fixes
6+
7+
* Support props with underscore, close [#55](https://github.com/vuejs/jsx/issues/55) ([852481c](https://github.com/vuejs/jsx/commit/852481c))
8+
9+
10+
11+
# [1.0.0-beta.3](https://github.com/vuejs/jsx/compare/v1.0.0-beta.2...v1.0.0-beta.3) (2019-03-22)
12+
13+
## other
14+
15+
#### Bug Fixes
16+
17+
* filter out jsx comments in `getChildren` ([7f0c84c](https://github.com/vuejs/jsx/commit/7f0c84c)), closes [#46](https://github.com/vuejs/jsx/issues/46)
18+
* fix incorrect repository urls ([99380b3](https://github.com/vuejs/jsx/commit/99380b3))
19+
20+
21+
122
# [1.0.0-beta.2](https://github.com/vuejs/jsx/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2019-01-11)
223

324
## other

‎README.md

Copy file name to clipboardExpand all lines: README.md
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,34 @@ render() {
8888
}
8989
```
9090

91+
### Slots
92+
93+
named slots:
94+
95+
```jsx
96+
render() {
97+
return (
98+
<MyComponent>
99+
<header slot="header">header</header>
100+
<footer slot="footer">footer</footer>
101+
</MyComponent>
102+
)
103+
}
104+
```
105+
106+
scoped slots:
107+
108+
```jsx
109+
render() {
110+
const scopedSlots = {
111+
header: () => <header>header</header>,
112+
footer: () => <footer>footer</footer>
113+
}
114+
115+
return <MyComponent scopedSlots={scopedSlots} />
116+
}
117+
```
118+
91119
### Directives
92120

93121
```jsx
@@ -112,6 +140,12 @@ with an argument and modifiers:
112140
<input vOn:click_stop_prevent="newTodoText" />
113141
```
114142

143+
v-html:
144+
145+
```jsx
146+
<p domPropsInnerHTML={html} />
147+
```
148+
115149
### Functional Components
116150

117151
Transpiles arrow functions that return JSX into functional components, when they are either default exports:

‎lerna.json

Copy file name to clipboardExpand all lines: lerna.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"packages": [
44
"packages/*"
55
],
6-
"version": "1.0.0-beta.2",
6+
"version": "1.0.0",
77
"npmClient": "yarn"
88
}

‎packages/babel-helper-vue-jsx-merge-props/package.json

Copy file name to clipboardExpand all lines: packages/babel-helper-vue-jsx-merge-props/package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/babel-helper-vue-jsx-merge-props",
3-
"version": "1.0.0-beta.2",
3+
"version": "1.0.0",
44
"description": "Babel helper for Vue JSX spread",
55
"main": "dist/helper.js",
66
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-helper-vue-jsx-merge-props",

‎packages/babel-plugin-transform-vue-jsx/package.json

Copy file name to clipboardExpand all lines: packages/babel-plugin-transform-vue-jsx/package.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/babel-plugin-transform-vue-jsx",
3-
"version": "1.0.0-beta.2",
3+
"version": "1.0.0",
44
"description": "Babel plugin for Vue 2.0 JSX",
55
"main": "dist/plugin.js",
66
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-plugin-transform-vue-jsx",
@@ -37,7 +37,7 @@
3737
"dependencies": {
3838
"@babel/helper-module-imports": "^7.0.0",
3939
"@babel/plugin-syntax-jsx": "^7.2.0",
40-
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0-beta.2",
40+
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
4141
"html-tags": "^2.0.0",
4242
"lodash.kebabcase": "^4.1.1",
4343
"svg-tags": "^1.0.0"

‎packages/babel-plugin-transform-vue-jsx/src/index.js

Copy file name to clipboardExpand all lines: packages/babel-plugin-transform-vue-jsx/src/index.js
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const getChildren = (t, paths) =>
8282
/* istanbul ignore next */
8383
throw new Error(`getChildren: ${path.type} is not supported`)
8484
})
85-
.filter(el => el !== null)
85+
.filter(el => el !== null && !t.isJSXEmptyExpression(el))
8686

8787
/**
8888
* Add attribute to an attributes object
@@ -163,7 +163,7 @@ const parseAttributeJSXAttribute = (t, path, attributes, tagName, elementType) =
163163
}
164164

165165
;[name, ...modifiers] = name.split('_')
166-
;[name, argument] = name.split(':')
166+
;[name, argument] = name.split(':')
167167

168168
prefix = prefixes.find(el => name.startsWith(el)) || 'attrs'
169169
name = name.replace(new RegExp(`^${prefix}\-?`), '')
@@ -196,6 +196,8 @@ const parseAttributeJSXAttribute = (t, path, attributes, tagName, elementType) =
196196
if (isDirective(name)) {
197197
name = kebabcase(name.substr(1))
198198
prefix = 'directives'
199+
} else {
200+
name = [name, ...modifiers].join('_')
199201
}
200202
if (name.match(xlinkRE)) {
201203
name = name.replace(xlinkRE, (_, firstCharacter) => {
@@ -299,15 +301,15 @@ const transformDirectives = (t, directives) =>
299301
: []),
300302
...(directive.value._modifiers && directive.value._modifiers.length > 0
301303
? [
302-
t.objectProperty(
303-
t.identifier('modifiers'),
304-
t.objectExpression(
305-
directive.value._modifiers.map(modifier =>
306-
t.objectProperty(t.stringLiteral(modifier), t.booleanLiteral(true)),
307-
),
304+
t.objectProperty(
305+
t.identifier('modifiers'),
306+
t.objectExpression(
307+
directive.value._modifiers.map(modifier =>
308+
t.objectProperty(t.stringLiteral(modifier), t.booleanLiteral(true)),
308309
),
309310
),
310-
]
311+
),
312+
]
311313
: []),
312314
]),
313315
),

‎packages/babel-plugin-transform-vue-jsx/test/snapshot.js

Copy file name to clipboardExpand all lines: packages/babel-plugin-transform-vue-jsx/test/snapshot.js
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,21 @@ h("MyComponent", _mergeJSXProps([{
325325
}
326326
}]));`,
327327
},
328+
{
329+
name: 'JSX comments',
330+
from: `<div><p>jsx</p>{/* <p>comment</p> */}</div>`,
331+
to: `h("div", [h("p", ["jsx"])]);`
332+
},
333+
{
334+
name: 'Underscore Props',
335+
from: `const MyComp = {}; render(h => <MyComponent attrs-my_prop="test">test</MyComponent>)`,
336+
to: `const MyComp = {};
337+
render(h => h("MyComponent", {
338+
"attrs": {
339+
"my_prop": "test"
340+
}
341+
}, ["test"]));`,
342+
}
328343
]
329344

330345
tests.forEach(({ name, from, to }) => test(name, async t => t.is(await transpile(from), to)))

‎packages/babel-preset-jsx/package.json

Copy file name to clipboardExpand all lines: packages/babel-preset-jsx/package.json
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@vue/babel-preset-jsx",
3-
"version": "1.0.0-beta.2",
3+
"version": "1.0.0",
44
"description": "Babel preset for Vue JSX",
55
"main": "dist/plugin.cjs.js",
6-
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-event-modifiers",
6+
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-preset-jsx",
77
"author": "Nick Messing <dot.nick.dot.messing@gmail.com>",
88
"license": "MIT",
99
"private": false,
@@ -13,12 +13,12 @@
1313
"prerelease": "yarn build"
1414
},
1515
"dependencies": {
16-
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0-beta.2",
17-
"@vue/babel-plugin-transform-vue-jsx": "^1.0.0-beta.2",
18-
"@vue/babel-sugar-functional-vue": "^1.0.0-beta.2",
19-
"@vue/babel-sugar-inject-h": "^1.0.0-beta.2",
20-
"@vue/babel-sugar-v-model": "^1.0.0-beta.2",
21-
"@vue/babel-sugar-v-on": "^1.0.0-beta.2"
16+
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
17+
"@vue/babel-plugin-transform-vue-jsx": "^1.0.0",
18+
"@vue/babel-sugar-functional-vue": "^1.0.0",
19+
"@vue/babel-sugar-inject-h": "^1.0.0",
20+
"@vue/babel-sugar-v-model": "^1.0.0",
21+
"@vue/babel-sugar-v-on": "^1.0.0"
2222
},
2323
"devDependencies": {
2424
"rollup": "^0.67.4",

‎packages/babel-sugar-functional-vue/package.json

Copy file name to clipboardExpand all lines: packages/babel-sugar-functional-vue/package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/babel-sugar-functional-vue",
3-
"version": "1.0.0-beta.2",
3+
"version": "1.0.0",
44
"description": "Babel syntactic sugar for functional components",
55
"main": "dist/plugin.js",
66
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-functional-vue",

‎packages/babel-sugar-inject-h/README.md

Copy file name to clipboardExpand all lines: packages/babel-sugar-inject-h/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default {
3939
}
4040
}
4141

42-
// Witho @vue/babel-sugar-inject-h
42+
// With @vue/babel-sugar-inject-h
4343
export default {
4444
render () {
4545
return <button />

‎packages/babel-sugar-inject-h/package.json

Copy file name to clipboardExpand all lines: packages/babel-sugar-inject-h/package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/babel-sugar-inject-h",
3-
"version": "1.0.0-beta.2",
3+
"version": "1.0.0",
44
"description": "Babel syntactic sugar for h automatic injection for Vue JSX",
55
"main": "dist/plugin.js",
66
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-inject-h",

‎packages/babel-sugar-v-model/package.json

Copy file name to clipboardExpand all lines: packages/babel-sugar-v-model/package.json
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@vue/babel-sugar-v-model",
3-
"version": "1.0.0-beta.2",
3+
"version": "1.0.0",
44
"description": "Babel syntactic sugar for v-model support in Vue JSX",
55
"main": "dist/plugin.js",
6-
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-event-modifiers",
6+
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-v-model",
77
"author": "Nick Messing <dot.nick.dot.messing@gmail.com>",
88
"license": "MIT",
99
"private": false,
@@ -36,8 +36,8 @@
3636
},
3737
"dependencies": {
3838
"@babel/plugin-syntax-jsx": "^7.2.0",
39-
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0-beta.2",
40-
"@vue/babel-plugin-transform-vue-jsx": "^1.0.0-beta.2",
39+
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
40+
"@vue/babel-plugin-transform-vue-jsx": "^1.0.0",
4141
"camelcase": "^5.0.0",
4242
"html-tags": "^2.0.0",
4343
"svg-tags": "^1.0.0"

‎packages/babel-sugar-v-on/package.json

Copy file name to clipboardExpand all lines: packages/babel-sugar-v-on/package.json
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@vue/babel-sugar-v-on",
3-
"version": "1.0.0-beta.2",
3+
"version": "1.0.0",
44
"description": "Babel syntactic sugar for v-model support in Vue JSX",
55
"main": "dist/plugin.js",
6-
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-event-modifiers",
6+
"repository": "https://github.com/vuejs/jsx/tree/master/packages/babel-sugar-v-on",
77
"author": "Nick Messing <dot.nick.dot.messing@gmail.com>",
88
"license": "MIT",
99
"private": false,
@@ -37,7 +37,7 @@
3737
},
3838
"dependencies": {
3939
"@babel/plugin-syntax-jsx": "^7.2.0",
40-
"@vue/babel-plugin-transform-vue-jsx": "^1.0.0-beta.2",
40+
"@vue/babel-plugin-transform-vue-jsx": "^1.0.0",
4141
"camelcase": "^5.0.0"
4242
},
4343
"nyc": {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.