From ed7febc131157ddaefb7f6cfe8b45c592dd473bb Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 7 Jan 2019 14:55:55 +0800 Subject: [PATCH] [improvement] upgrade babel-preset-jsx (#2452) --- babel.config.js | 8 +- package.json | 4 +- .../test/__snapshots__/demo.spec.js.snap | 9 ++- .../card/test/__snapshots__/demo.spec.js.snap | 8 +- yarn.lock | 81 ++++++++++++++++--- 5 files changed, 90 insertions(+), 20 deletions(-) diff --git a/babel.config.js b/babel.config.js index d7da7b5cc..ca3e911c2 100644 --- a/babel.config.js +++ b/babel.config.js @@ -12,6 +12,13 @@ module.exports = function (api) { loose: true, modules: useESModules ? false : 'commonjs' } + ], + [ + '@vue/babel-preset-jsx', + { + vModel: true, + injectH: true + } ] ], plugins: [ @@ -24,7 +31,6 @@ module.exports = function (api) { useESModules } ], - 'transform-vue-jsx', '@babel/plugin-syntax-dynamic-import', '@babel/plugin-transform-object-assign' ] diff --git a/package.json b/package.json index 525ecc383..986c9b21d 100644 --- a/package.json +++ b/package.json @@ -77,14 +77,14 @@ "@vant/doc": "^1.0.21", "@vant/eslint-config": "^1.0.8", "@vant/markdown-loader": "^1.0.3", + "@vue/babel-helper-vue-jsx-merge-props": "^1.0.0-beta.1", + "@vue/babel-preset-jsx": "^1.0.0-beta.1", "@vue/server-test-utils": "^1.0.0-beta.26", "@vue/test-utils": "^1.0.0-beta.26", "autoprefixer": "^9.4.3", "babel-core": "^7.0.0-0", - "babel-helper-vue-jsx-merge-props": "^2.0.3", "babel-jest": "^23.6.0", "babel-loader": "^8.0.4", - "babel-plugin-transform-vue-jsx": "4.0.1", "codecov": "^3.1.0", "cross-env": "^5.2.0", "css-loader": "^2.1.0", diff --git a/packages/badge/test/__snapshots__/demo.spec.js.snap b/packages/badge/test/__snapshots__/demo.spec.js.snap index 85f87fc47..dc5f0e27c 100644 --- a/packages/badge/test/__snapshots__/demo.spec.js.snap +++ b/packages/badge/test/__snapshots__/demo.spec.js.snap @@ -8,13 +8,16 @@ exports[`renders demo correctly 1`] = ` -
标签名称
8
+
标签名称 +
8
- diff --git a/packages/card/test/__snapshots__/demo.spec.js.snap b/packages/card/test/__snapshots__/demo.spec.js.snap index fc8c4eda6..cd6b1bdf9 100644 --- a/packages/card/test/__snapshots__/demo.spec.js.snap +++ b/packages/card/test/__snapshots__/demo.spec.js.snap @@ -4,12 +4,15 @@ exports[`renders demo correctly 1`] = `
-
+
+
2018秋冬新款男士休闲时尚军绿飞行夹克秋冬新款男
描述信息
+
¥ 2.00
+
x 2
@@ -18,7 +21,8 @@ exports[`renders demo correctly 1`] = `
-
标签 +
+ 标签
2018秋冬新款男士休闲时尚军绿飞行夹克秋冬新款男
描述信息
diff --git a/yarn.lock b/yarn.lock index 63f743754..56c68478b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -724,6 +724,70 @@ highlight.js "^9.12.0" markdown-it "^8.4.0" +"@vue/babel-helper-vue-jsx-merge-props@^1.0.0-beta.1": + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.0.0-beta.1.tgz#cbfa2b4fef05d0462fe770759fe1766ba223c1d1" + integrity sha512-N5uSbvShCF7pMuk4gOoMaM/oAhr4Vt5s1DRnevuhCeRP2UtwDC6GuFFNFuhuefOsWwpAX/PmrSxA6kDH/GGQlg== + +"@vue/babel-plugin-transform-vue-jsx@^1.0.0-beta.1": + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/@vue/babel-plugin-transform-vue-jsx/-/babel-plugin-transform-vue-jsx-1.0.0-beta.1.tgz#ac1e8577eb6138a6f15025a0b2639cf9accd7b43" + integrity sha512-/ZV09X4BtA5OPdnQqQaxhD1aRBQF8PVY/ZUnQtrk4jld7+Mfy9CxT4gCznoJ+KFooCbyjvwhotB72Hg7N3T4zg== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.2.0" + "@vue/babel-helper-vue-jsx-merge-props" "^1.0.0-beta.1" + html-tags "^2.0.0" + lodash.kebabcase "^4.1.1" + svg-tags "^1.0.0" + +"@vue/babel-preset-jsx@^1.0.0-beta.1": + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/@vue/babel-preset-jsx/-/babel-preset-jsx-1.0.0-beta.1.tgz#3af92fdc90387851ef7873525d081d193fac2140" + integrity sha512-Nx6+KEJKApsofsYElwFaU7bnBWjMatAgUBFR45qMNl2KpwVOrgNABCbrX/9IqxZIOGCpRuzD96pWmnxFnu2HVQ== + dependencies: + "@vue/babel-helper-vue-jsx-merge-props" "^1.0.0-beta.1" + "@vue/babel-plugin-transform-vue-jsx" "^1.0.0-beta.1" + "@vue/babel-sugar-functional-vue" "^1.0.0-beta.1" + "@vue/babel-sugar-inject-h" "^1.0.0-beta.1" + "@vue/babel-sugar-v-model" "^1.0.0-beta.1" + "@vue/babel-sugar-v-on" "^1.0.0-beta.1" + +"@vue/babel-sugar-functional-vue@^1.0.0-beta.1": + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/@vue/babel-sugar-functional-vue/-/babel-sugar-functional-vue-1.0.0-beta.1.tgz#9b883d7564c358fda938670cffd4603d5a86bded" + integrity sha512-FD53t0SxlkNtCk78C/fl1WR79tOLYMOEcku0ie0nKhjn/gy56fhYOMlUjutjE/mdVa4wHSHnz2WC7N8e4zbxPg== + dependencies: + "@babel/plugin-syntax-jsx" "^7.2.0" + +"@vue/babel-sugar-inject-h@^1.0.0-beta.1": + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/@vue/babel-sugar-inject-h/-/babel-sugar-inject-h-1.0.0-beta.1.tgz#89d56355aa69cc6074e6d28f311566cdb8522ba2" + integrity sha512-/0Key+jZfxjRb1b7NPS29rrYzPXGqoYxRim54eVFzcAF255O5DCcBDbePGb/ktza2aA8ZvzPfnc/uNxcLA82FQ== + dependencies: + "@babel/plugin-syntax-jsx" "^7.2.0" + +"@vue/babel-sugar-v-model@^1.0.0-beta.1": + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/@vue/babel-sugar-v-model/-/babel-sugar-v-model-1.0.0-beta.1.tgz#f52a67bfe235f34478fc5804453415231fb0d213" + integrity sha512-TLcBppivEHL9oeAafLfxBG3M4FFnVp1BX8joBJwvfgMOFgarNux8QhttbqQSMAAVX4j6GOf1xlXpXK2odQHB0w== + dependencies: + "@babel/plugin-syntax-jsx" "^7.2.0" + "@vue/babel-helper-vue-jsx-merge-props" "^1.0.0-beta.1" + "@vue/babel-plugin-transform-vue-jsx" "^1.0.0-beta.1" + camelcase "^5.0.0" + html-tags "^2.0.0" + svg-tags "^1.0.0" + +"@vue/babel-sugar-v-on@^1.0.0-beta.1": + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/@vue/babel-sugar-v-on/-/babel-sugar-v-on-1.0.0-beta.1.tgz#2c98417ac625bbf1bad11fc3e103b7b6558fcb0e" + integrity sha512-K+QecqeKZseWoGkxMAuV08XqumPqBpQ681NwFsSZyj6Pfz5XpEPPlCH3nQ+7KC4yxjbH9bjIGVtkpvbONIfbvA== + dependencies: + "@babel/plugin-syntax-jsx" "^7.2.0" + "@vue/babel-plugin-transform-vue-jsx" "^1.0.0-beta.1" + camelcase "^5.0.0" + "@vue/component-compiler-utils@^2.0.0": version "2.3.1" resolved "https://registry.yarnpkg.com/@vue/component-compiler-utils/-/component-compiler-utils-2.3.1.tgz#d1c2623f02ad3fe6b6fc9c3762be55c9c61e3977" @@ -1360,11 +1424,6 @@ babel-generator@^6.18.0, babel-generator@^6.26.0: source-map "^0.5.7" trim-right "^1.0.1" -babel-helper-vue-jsx-merge-props@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz#22aebd3b33902328e513293a8e4992b384f9f1b6" - integrity sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg== - babel-helpers@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" @@ -1427,13 +1486,6 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" -babel-plugin-transform-vue-jsx@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-vue-jsx/-/babel-plugin-transform-vue-jsx-4.0.1.tgz#2c8bddce87a6ef09eaa59869ff1bfbeeafc5f88d" - integrity sha512-wbOz7ITB5cloLSjKUU1hWn8zhR+Dwah/RZiTiJY/CQliCwhowmzu6m7NEF+y5EJX/blDzGjRtZvC10Vdb3Q7vw== - dependencies: - esutils "^2.0.2" - babel-preset-jest@^23.2.0: version "23.2.0" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-23.2.0.tgz#8ec7a03a138f001a1a8fb1e8113652bf1a55da46" @@ -5651,6 +5703,11 @@ lodash.isarray@^3.0.0: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" +lodash.kebabcase@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz#8489b1cb0d29ff88195cceca448ff6d6cc295c36" + integrity sha1-hImxyw0p/4gZXM7KRI/21swpXDY= + lodash.keys@^3.0.0: version "3.1.2" resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a"