From ff4a10dcb9165fdc64dba19835f521413e48afd2 Mon Sep 17 00:00:00 2001 From: chenjiajian <798095202@qq.com> Date: Tue, 9 Feb 2021 17:30:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(loader):=20=E4=BF=AE=E5=A4=8D=E7=99=BE?= =?UTF-8?q?=E5=BA=A6=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=B8=B2=E6=9F=93=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C#7293?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- packages/taro-cli/src/doctor/configSchema.ts | 2 +- packages/taro-loader/src/page.ts | 2 +- .../__snapshots__/alipay.spec.ts.snap | 6 +- .../__snapshots__/babel.spec.ts.snap | 6 +- .../__snapshots__/bytedance.spec.ts.snap | 6 +- .../__snapshots__/common-style.spec.ts.snap | 12 +++- .../__snapshots__/config.spec.ts.snap | 18 +++++- .../__snapshots__/css-modules.spec.ts.snap | 12 +++- .../__snapshots__/custom-tabbar.spec.ts.snap | Bin 88426 -> 88558 bytes .../__tests__/__snapshots__/jd.spec.ts.snap | 6 +- .../__tests__/__snapshots__/nerv.spec.ts.snap | 6 +- .../__snapshots__/parse-html.spec.ts.snap | 6 +- .../__snapshots__/prerender.spec.ts.snap | 54 +++++++++++++++--- .../__tests__/__snapshots__/qq.spec.ts.snap | 12 +++- .../__snapshots__/react.spec.ts.snap | 6 +- .../__tests__/__snapshots__/sass.spec.ts.snap | 24 ++++++-- .../__snapshots__/subpackages.spec.ts.snap | 18 +++++- .../__tests__/__snapshots__/swan.spec.ts.snap | 6 +- .../__snapshots__/tabbar.spec.ts.snap | Bin 155971 -> 156235 bytes .../__tests__/__snapshots__/ts.spec.ts.snap | 6 +- .../__tests__/__snapshots__/vue.spec.ts.snap | 6 +- .../__tests__/__snapshots__/vue3.spec.ts.snap | 6 +- .../__snapshots__/wx-hybrid.spec.ts.snap | 6 +- yarn.lock | 2 +- 25 files changed, 189 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index f3cc10a55b8e..4099f8c49069 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@types/jest": "^26.0.14", "@types/lodash": "^4.14.142", "@types/node": "^12.7.11", - "@types/react": "^16.9.5", + "@types/react": "16.9.49", "@types/sinon": "^7.5.0", "@types/tapable": "1.0.5", "@types/webpack": "^4.39.3", diff --git a/packages/taro-cli/src/doctor/configSchema.ts b/packages/taro-cli/src/doctor/configSchema.ts index adedb41fd04e..91c24accc339 100644 --- a/packages/taro-cli/src/doctor/configSchema.ts +++ b/packages/taro-cli/src/doctor/configSchema.ts @@ -31,7 +31,7 @@ const schema = Joi.object().keys({ Joi.object().keys({ from: Joi.string().required(), to: Joi.string().required(), - ignore: Joi.string() + ignore: Joi.array().items(Joi.string()) }) ), diff --git a/packages/taro-loader/src/page.ts b/packages/taro-loader/src/page.ts index aadbc573b97b..034e7446dcb0 100644 --- a/packages/taro-loader/src/page.ts +++ b/packages/taro-loader/src/page.ts @@ -31,7 +31,7 @@ import component from ${stringify(componentPath)} var config = ${configString}; ${config.enableShareTimeline ? 'component.enableShareTimeline = true' : ''} ${config.enableShareAppMessage ? 'component.enableShareAppMessage = true' : ''} -var inst = Page(createPageConfig(component, '${options.name}', {}, config || {})) +var inst = Page(createPageConfig(component, '${options.name}', {root:{cn:[]}}, config || {})) ${options.prerender ? prerender : ''} ` } diff --git a/packages/taro-mini-runner/src/__tests__/__snapshots__/alipay.spec.ts.snap b/packages/taro-mini-runner/src/__tests__/__snapshots__/alipay.spec.ts.snap index 5686132da062..815a0300b5bf 100644 --- a/packages/taro-mini-runner/src/__tests__/__snapshots__/alipay.spec.ts.snap +++ b/packages/taro-mini-runner/src/__tests__/__snapshots__/alipay.spec.ts.snap @@ -850,7 +850,11 @@ require(\\"./taro\\"); var config = { navigationBarTitleText: \\"\\\\u9996\\\\u9875\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", { + root: { + cn: [] + } + }, config || {})); } ], [ [ 18, 0, 1, 3, 2 ] ] ]); /** filePath: dist/pages/index/index.json **/ diff --git a/packages/taro-mini-runner/src/__tests__/__snapshots__/babel.spec.ts.snap b/packages/taro-mini-runner/src/__tests__/__snapshots__/babel.spec.ts.snap index ade97315e685..9d8df0d2ad3e 100644 --- a/packages/taro-mini-runner/src/__tests__/__snapshots__/babel.spec.ts.snap +++ b/packages/taro-mini-runner/src/__tests__/__snapshots__/babel.spec.ts.snap @@ -864,7 +864,11 @@ require(\\"./taro\\"); var config = { navigationBarTitleText: \\"\\\\u9996\\\\u9875\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", { + root: { + cn: [] + } + }, config || {})); } }, [ [ 15, 0, 1, 3, 2 ] ] ]); diff --git a/packages/taro-mini-runner/src/__tests__/__snapshots__/bytedance.spec.ts.snap b/packages/taro-mini-runner/src/__tests__/__snapshots__/bytedance.spec.ts.snap index e7e3d9502c81..31a172e48338 100644 --- a/packages/taro-mini-runner/src/__tests__/__snapshots__/bytedance.spec.ts.snap +++ b/packages/taro-mini-runner/src/__tests__/__snapshots__/bytedance.spec.ts.snap @@ -843,7 +843,11 @@ require(\\"./taro\\"); var config = { navigationBarTitleText: \\"\\\\u9996\\\\u9875\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", { + root: { + cn: [] + } + }, config || {})); } ], [ [ 18, 0, 1, 3, 2 ] ] ]); /** filePath: dist/pages/index/index.json **/ diff --git a/packages/taro-mini-runner/src/__tests__/__snapshots__/common-style.spec.ts.snap b/packages/taro-mini-runner/src/__tests__/__snapshots__/common-style.spec.ts.snap index f5b2b0cd65f3..c28eb854a61c 100644 --- a/packages/taro-mini-runner/src/__tests__/__snapshots__/common-style.spec.ts.snap +++ b/packages/taro-mini-runner/src/__tests__/__snapshots__/common-style.spec.ts.snap @@ -898,7 +898,11 @@ require(\\"./taro\\"); var config = { navigationBarTitleText: \\"\\\\u5173\\\\u4e8e\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(about_Index, \\"pages/about/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(about_Index, \\"pages/about/index\\", { + root: { + cn: [] + } + }, config || {})); } }, [ [ 18, 0, 1, 3, 2 ] ] ]); @@ -944,7 +948,11 @@ require(\\"./taro\\"); var config = { navigationBarTitleText: \\"\\\\u9996\\\\u9875\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", { + root: { + cn: [] + } + }, config || {})); } }, [ [ 17, 0, 1, 3, 2 ] ] ]); diff --git a/packages/taro-mini-runner/src/__tests__/__snapshots__/config.spec.ts.snap b/packages/taro-mini-runner/src/__tests__/__snapshots__/config.spec.ts.snap index b51efda1786b..d151c2000db2 100644 --- a/packages/taro-mini-runner/src/__tests__/__snapshots__/config.spec.ts.snap +++ b/packages/taro-mini-runner/src/__tests__/__snapshots__/config.spec.ts.snap @@ -1014,7 +1014,11 @@ require(\\"./taro\\"); var config = { navigationBarTitleText: \\"\\\\u9996\\\\u9875\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", { + root: { + cn: [] + } + }, config || {})); } }, [ [ 14, 0, 1, 3, 2 ] ] ]); @@ -2146,7 +2150,11 @@ require(\\"./taro\\"); var config = { navigationBarTitleText: \\"\\\\u9996\\\\u9875\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", { + root: { + cn: [] + } + }, config || {})); } }, [ [ 14, 0, 1, 3, 2 ] ] ]); @@ -3282,7 +3290,11 @@ I m irrelevant. var config = { navigationBarTitleText: \\"\\\\u9996\\\\u9875\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", { + root: { + cn: [] + } + }, config || {})); } }, [ [ 14, 0, 1, 3, 2 ] ] ]); diff --git a/packages/taro-mini-runner/src/__tests__/__snapshots__/css-modules.spec.ts.snap b/packages/taro-mini-runner/src/__tests__/__snapshots__/css-modules.spec.ts.snap index f88f065f7aff..efd06ac47416 100644 --- a/packages/taro-mini-runner/src/__tests__/__snapshots__/css-modules.spec.ts.snap +++ b/packages/taro-mini-runner/src/__tests__/__snapshots__/css-modules.spec.ts.snap @@ -877,7 +877,11 @@ require(\\"./taro\\"); var config = { navigationBarTitleText: \\"\\\\u9996\\\\u9875\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", { + root: { + cn: [] + } + }, config || {})); }, 7: function(module, exports, __webpack_require__) { module.exports = { @@ -2031,7 +2035,11 @@ require(\\"./taro\\"); var config = { navigationBarTitleText: \\"\\\\u9996\\\\u9875\\" }; - var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", {}, config || {})); + var inst = Page(Object(taro_runtime[\\"createPageConfig\\"])(index_Index, \\"pages/index/index\\", { + root: { + cn: [] + } + }, config || {})); }, 7: function(module, exports, __webpack_require__) { module.exports = { diff --git a/packages/taro-mini-runner/src/__tests__/__snapshots__/custom-tabbar.spec.ts.snap b/packages/taro-mini-runner/src/__tests__/__snapshots__/custom-tabbar.spec.ts.snap index 46b28be1521d0da2fb32914af482da4f6d05726d..1b6c222f706dc807f06271ad3f9e10f5db37fd65 100644 GIT binary patch delta 96 zcmaF0iS^xP)`l&N(prLC3P_+RKfh%1L=F+Q