Skip to content

Commit

Permalink
fix(weapp/alipay):修复root-portal不支持嵌套的问题,fix #12878
Browse files Browse the repository at this point in the history
* fix: 修复canvasContext的createLinearGradient循环调用的问题

* fix(weapp):修复root-portal不支持嵌套的问题

* fix(template): 将 root-portal 的处理放到端平台插件里

---------

Co-authored-by: 三少 <sanshao@dian.so>
Co-authored-by: chenjiajian <798095202@qq.com>
  • Loading branch information
3 people committed Mar 18, 2024
1 parent e2a58bb commit 2413691
Show file tree
Hide file tree
Showing 36 changed files with 2,542 additions and 2,531 deletions.
2 changes: 1 addition & 1 deletion packages/shared/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,5 +537,5 @@ export const nestElements = new Map([
['form', 4],
['scroll-view', 4],
['swiper', 4],
['swiper-item', 4]
['swiper-item', 4],
])
5 changes: 5 additions & 0 deletions packages/taro-alipay/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export class Template extends RecursiveTemplate {

transferComponents: Record<string, Record<string, string>> = {}

constructor () {
super()
this.nestElements.set('root-portal', 3)
}

buildXsTemplate (filePath = './utils') {
return `<import-sjs name="xs" from="${filePath}.sjs" />`
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

212 changes: 106 additions & 106 deletions packages/taro-mini-runner/src/__tests__/__snapshots__/config.spec.ts.snap

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

844 changes: 422 additions & 422 deletions packages/taro-mini-runner/src/__tests__/__snapshots__/qq.spec.ts.snap

Large diffs are not rendered by default.

Large diffs are not rendered by default.

272 changes: 136 additions & 136 deletions packages/taro-mini-runner/src/__tests__/__snapshots__/sass.spec.ts.snap

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/taro-mini-runner/src/__tests__/qq.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { QQ } from '@tarojs/plugin-platform-qq'
import { compile, getOutput } from './utils/compiler'

const program = new QQ({ helper } as any, {})
program.modifyTemplate({})
program.beforeBuild()

const customConfig = {
buildAdapter: 'qq',
globalObject: program.globalObject,
Expand Down
1 change: 1 addition & 0 deletions packages/taro-mini-runner/src/__tests__/utils/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export async function compile (app: string, customConfig: Partial<IBuildConfig>

if (!customConfig.buildAdapter) {
const program = new Weapp({ helper } as any, {})
program.modifyTemplate?.({})
customConfig.globalObject = program.globalObject
customConfig.fileType = program.fileType
customConfig.template = program.template
Expand Down
1 change: 1 addition & 0 deletions packages/taro-weapp/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class Template extends UnRecursiveTemplate {
constructor (pluginOptions?: IOptions) {
super()
this.pluginOptions = pluginOptions || {}
this.nestElements.set('root-portal', 3)
}

buildXsTemplate (filePath = './utils') {
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4565,8 +4565,8 @@ require("./runtime");
/** filePath: dist/utils.jds **/
module.exports = {
a: function (l, n, s) {
var a = ["7","0","18","5","2","11","6","4","39","40","22","19","37","41","42"]
var b = ["4","39","40","22","19","37","41","42"]
var a = ["7","0","18","5","2","11","6","4","39","40","22","19","37","41","42","root-portal"]
var b = ["4","39","40","22","19","37","41","42","root-portal"]
if (a.indexOf(n) === -1) {
l = 0
}
Expand Down Expand Up @@ -4594,7 +4594,7 @@ module.exports = {
return 'tmpl_' + n + '_container'
},
f: function (l, n) {
var b = ["4","39","40","22","19","37","41","42"]
var b = ["4","39","40","22","19","37","41","42","root-portal"]
if (b.indexOf(n) > -1) {
if (l) l += ','
l += n
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export async function compile<T extends MiniBuildConfig | H5BuildConfig = Common

if (isMiniConfig(customConfig) && customConfig.buildAdapter === 'weapp') {
const program = new Weapp({ helper } as any, {})
program.modifyTemplate?.({})
customConfig.globalObject = program.globalObject
customConfig.fileType = program.fileType
customConfig.template = program.template
Expand Down

0 comments on commit 2413691

Please sign in to comment.