Skip to content

Commit

Permalink
fix(h5): uncompiled es syntax (#7522)
Browse files Browse the repository at this point in the history
* fix(h5): uncompiled es syntax

* fix(h5): eslint

* revert(webpack-runner): wrong change

* fix(dependencies): lock upload

* fix(types): jest typing and upload test snapshots

Co-authored-by: yuhuanzhu <yuhuanzhu@bytedance.com>
Co-authored-by: chenjiajian <798095202@qq.com>
Co-authored-by: Zakary <zakarycode@gmail.com>
  • Loading branch information
4 people authored Sep 23, 2020
1 parent 29bae71 commit c3f34dc
Show file tree
Hide file tree
Showing 21 changed files with 6,436 additions and 1,570 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@types/debug": "4.1.5",
"@types/fs-extra": "8.1.0",
"@types/hapi__joi": "16.0.12",
"@types/jest": "^24.0.18",
"@types/jest": "^26.0.14",
"@types/lodash": "^4.14.142",
"@types/node": "^12.7.11",
"@types/react": "^16.9.5",
Expand Down Expand Up @@ -113,12 +113,11 @@
"gulp-typescript": "^5.0.1",
"html-webpack-plugin": "^3.0.6",
"husky": "^1.2.0",
"jest": "25.4",
"jest": "26.4.2",
"jest-dom": "^1.3.1",
"jest-enzyme": "^7.1.1",
"jest-localstorage-mock": "^2.4.0",
"jest-mock-console": "^1.0.0",
"karmatic": "^1.4.0",
"lerna": "3.22.1",
"lint-staged": "^10.2.11",
"memfs": "^3.1.2",
Expand Down Expand Up @@ -153,7 +152,7 @@
"sinon": "^7.5.0",
"style-loader": "^0.20.3",
"stylelint": "^13.6.1",
"ts-jest": "23",
"ts-jest": "26.4.0",
"typescript": "^3.8.3",
"vue": "^2.6.11",
"vue-loader": "^15.9.3",
Expand Down
4 changes: 0 additions & 4 deletions packages/taro-cli/__tests__/info.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-ignore */
import * as path from 'path'
import chalk from 'chalk'
import { run } from './utils'
Expand Down Expand Up @@ -31,9 +30,7 @@ describe('info', () => {
await runInfo('')
} catch (error) {}

// @ts-ignore
expect(exitSpy).toBeCalledWith(1)
// @ts-ignore
expect(logSpy).toBeCalledWith(chalk.red('找不到项目配置文件config/index,请确定当前目录是 Taro 项目根目录!'))

exitSpy.mockRestore()
Expand All @@ -47,7 +44,6 @@ describe('info', () => {
const appPath = path.resolve(__dirname, 'fixtures/default')
await runInfo(appPath)

// @ts-ignore
expect(logSpy).toBeCalledTimes(1)
const res = logSpy.mock.calls[0][0]
const title = `Taro CLI ${getPkgVersion()} environment info`
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-cli/__tests__/update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ describe('update', () => {
args: ['project']
})
} catch (error) {}
expect(chalkMocked).toBeCalledWith(`找不到项目配置文件${PROJECT_CONFIG},请确定当前目录是Taro项目根目录!`)
expect(exitSpy).toBeCalledWith(1)
expect(chalkMocked).toBeCalledWith(`找不到项目配置文件${PROJECT_CONFIG},请确定当前目录是Taro项目根目录!`)
exitSpy.mockRestore()
logSpy.mockRestore()
})
Expand Down
1 change: 1 addition & 0 deletions packages/taro-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"weui": "^1.1.2"
},
"devDependencies": {
"karmatic": "^2.1.0",
"@stencil/sass": "~1.1.1",
"jquery": "^3.4.1",
"simulant": "^0.2.2",
Expand Down
5,888 changes: 5,713 additions & 175 deletions packages/taro-components/yarn.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions packages/taro-h5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"jsonp-retry": "^1.0.3",
"mobile-detect": "^1.4.2",
"raf": "^3.4.1",
"unfetch": "^4.1.0",
"whatwg-fetch": "^2.0.4"
"whatwg-fetch": "^3.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/taro-h5/src/api/request/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Taro from '@tarojs/api'
import 'unfetch/polyfill'
import 'whatwg-fetch'
import jsonpRetry from 'jsonp-retry'
import { serializeParams } from '../utils'
const { Link } = Taro
Expand Down
13 changes: 4 additions & 9 deletions packages/taro-h5/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ raf@^3.4.1:
dependencies:
performance-now "^2.1.0"

unfetch@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.1.0.tgz#6ec2dd0de887e58a4dee83a050ded80ffc4137db"
integrity sha512-crP/n3eAPUJxZXM9T80/yv0YhkTEx2K1D3h7D1AJM6fzsWZrxdyRuLN0JH/dkZh1LNH8LxCnBzoPFCPbb2iGpg==

whatwg-fetch@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"
integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==
whatwg-fetch@^3.4.0:
version "3.4.1"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.4.1.tgz#e5f871572d6879663fa5674c8f833f15a8425ab3"
integrity sha512-sofZVzE1wKwO+EYPbWfiwzaKovWiZXf4coEzjGP9b2GBVgQRLQUZ2QcuPpQExGDAW5GItpEm6Tl4OU5mywnAoQ==
2 changes: 1 addition & 1 deletion packages/taro-loader/src/h5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ window.__taroAppConfig = config
${config.tabBar ? tabBarCode : ''}
if (config.tabBar) {
var tabbarList = config.tabBar.list
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i]
if (t.iconPath) {
t.iconPath = tabbarIconPath[i]
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-router-rn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"author": "O2Team",
"license": "MIT",
"dependencies": {
"@types/jest": "^24.0.15",
"@types/jest": "^26.0.14",
"query-string": "^6.1.0",
"react-navigation": "^2.9.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ exports[`babel should convert do expressions 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ exports[`config should build from origin and pipe to output 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down Expand Up @@ -1574,7 +1574,7 @@ I m irrelevant.
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down Expand Up @@ -2374,7 +2374,7 @@ exports[`config should resolved alias 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ exports[`css modules should use css modules with global mode 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down Expand Up @@ -1600,7 +1600,7 @@ exports[`css modules should use css modules with module mode 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ exports[`nerv should build nerv app 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ exports[`react should build react app 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ exports[`sass should build app with sass 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down Expand Up @@ -1542,7 +1542,7 @@ exports[`sass should build app with scss 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down Expand Up @@ -2338,7 +2338,7 @@ exports[`sass should set global sass content with data 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down Expand Up @@ -3134,7 +3134,7 @@ exports[`sass should set global sass content with source & dir 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down Expand Up @@ -3930,7 +3930,7 @@ exports[`sass should set global sass content with source 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ exports[`subpackages should process subpackages 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ exports[`typescript should build project with ts 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ exports[`vue should build vue app 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ exports[`vue3 should build vue3 app 2`] = `
taro_runtime_window.__taroAppConfig = config;
if (config.tabBar) {
var tabbarList = config.tabBar.list;
for (let i = 0; i < tabbarList.length; i++) {
for (var i = 0; i < tabbarList.length; i++) {
var t = tabbarList[i];
if (t.iconPath) {
t.iconPath = tabbarIconPath[i];
Expand Down
Loading

0 comments on commit c3f34dc

Please sign in to comment.