@dcloudio/uni-cli-shared 2.0.2-alpha-4080120250905001 → 2.0.2-alpha-4080120250919002

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,6 +70,7 @@ export default {
70
70
  if (this.preload && this._canCreateAd()) {
71
71
  this.load()
72
72
  }
73
+ this._dispatchEvent('adcreated', { instance: this })
73
74
  },
74
75
  methods: {
75
76
  load () {
@@ -389,6 +390,10 @@ export default {
389
390
  this._dispatchEvent(EventType.Error, err)
390
391
  }
391
392
  })
393
+ },
394
+
395
+ toJSON () {
396
+ return ''
392
397
  }
393
398
  }
394
399
  }
@@ -64,8 +64,9 @@ export default {
64
64
  }
65
65
  },
66
66
  created () {
67
- const page = getCurrentPages()[0]
68
- this.$pageVm = page.$vm || page
67
+ const pages = getCurrentPages()
68
+ const currentPage = pages[pages.length - 1]
69
+ this.$pageVm = currentPage.$vm || currentPage
69
70
  // event
70
71
  // h5 暂不支持生命周期 onResize,补充后,可以移除该条件编译
71
72
  // #ifdef H5
@@ -84,7 +85,7 @@ export default {
84
85
  })
85
86
 
86
87
  // #ifdef APP-PLUS
87
- this._currentWebview = page.$getAppWebview()
88
+ this._currentWebview = currentPage.$getAppWebview()
88
89
  if (this.enablePullDownRefresh) {
89
90
  this.setPullDownRefresh(this._currentWebview, true)
90
91
  }
@@ -102,7 +103,7 @@ export default {
102
103
  this.rootFontSize,
103
104
  this.pageStyle
104
105
  ], () => {
105
- this.setPageMeta()
106
+ this.setPageMeta(currentPage.$page.id)
106
107
  })
107
108
  this.$watch(() => [
108
109
  this.backgroundColor,
@@ -128,6 +129,11 @@ export default {
128
129
  mounted () {
129
130
  this.scrollTop && this.pageScrollTo()
130
131
  },
132
+ // #ifdef H5
133
+ activated () {
134
+ this.setPageMeta()
135
+ },
136
+ // #endif
131
137
  methods: {
132
138
  setPullDownRefresh (webview, enabled) {
133
139
  webview.setStyle({
@@ -137,12 +143,15 @@ export default {
137
143
  }
138
144
  })
139
145
  },
140
- setPageMeta () {
146
+ setPageMeta (pageId) {
141
147
  // h5 和 app-plus 设置 rootFontSize
142
148
  // #ifdef H5 || APP-PLUS
143
- uni.setPageMeta({
144
- pageStyle: this.pageStyle,
145
- rootFontSize: this.rootFontSize
149
+ this.$nextTick(() => {
150
+ uni.setPageMeta({
151
+ pageStyle: this.pageStyle,
152
+ rootFontSize: this.rootFontSize,
153
+ pageId
154
+ })
146
155
  })
147
156
  // #endif
148
157
  },
@@ -149,43 +149,44 @@ module.exports = async function (content) {
149
149
  )
150
150
  }
151
151
 
152
- if (!utsPlugins.has(pluginId)) {
153
- utsPlugins.add(pluginId)
154
- if (uniXKotlinCompiler) {
155
- const platform = 'app-android'
156
- const vueFiles = resolveTscUniModuleUTSSDKVueFileNames(
157
- platform,
158
- pluginDir
159
- )
160
- for (const vueFile of vueFiles) {
161
- await uniXKotlinCompiler.addRootFile(vueFile)
162
- }
163
- const indexFileName = resolveTscUniModuleIndexFileName(
164
- platform,
165
- pluginDir
166
- )
167
- if (indexFileName) {
168
- await uniXKotlinCompiler.addRootFile(indexFileName)
169
- }
152
+ // 不判重了,不然nvue,vue并发同一个插件时,其中一个会跳过tsc编译,直接走到rust那里,导致一些文件还没有生成,比如vue兼容模式组件之类的
153
+ // if (!utsPlugins.has(pluginId)) {
154
+ utsPlugins.add(pluginId)
155
+ if (uniXKotlinCompiler) {
156
+ const platform = 'app-android'
157
+ const vueFiles = resolveTscUniModuleUTSSDKVueFileNames(
158
+ platform,
159
+ pluginDir
160
+ )
161
+ for (const vueFile of vueFiles) {
162
+ await uniXKotlinCompiler.addRootFile(vueFile)
170
163
  }
171
- if (uniXSwiftCompiler) {
172
- const platform = 'app-ios'
173
- const vueFiles = resolveTscUniModuleUTSSDKVueFileNames(
174
- platform,
175
- pluginDir
176
- )
177
- for (const vueFile of vueFiles) {
178
- await uniXSwiftCompiler.addRootFile(vueFile)
179
- }
180
- const indexFileName = resolveTscUniModuleIndexFileName(
181
- platform,
182
- pluginDir
183
- )
184
- if (indexFileName) {
185
- await uniXSwiftCompiler.addRootFile(indexFileName)
186
- }
164
+ const indexFileName = resolveTscUniModuleIndexFileName(
165
+ platform,
166
+ pluginDir
167
+ )
168
+ if (indexFileName) {
169
+ await uniXKotlinCompiler.addRootFile(indexFileName)
170
+ }
171
+ }
172
+ if (uniXSwiftCompiler) {
173
+ const platform = 'app-ios'
174
+ const vueFiles = resolveTscUniModuleUTSSDKVueFileNames(
175
+ platform,
176
+ pluginDir
177
+ )
178
+ for (const vueFile of vueFiles) {
179
+ await uniXSwiftCompiler.addRootFile(vueFile)
180
+ }
181
+ const indexFileName = resolveTscUniModuleIndexFileName(
182
+ platform,
183
+ pluginDir
184
+ )
185
+ if (indexFileName) {
186
+ await uniXSwiftCompiler.addRootFile(indexFileName)
187
187
  }
188
188
  }
189
+ // }
189
190
 
190
191
  // 处理uni_modules中的文件变更
191
192
  const files = changedFiles.get(pluginId)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "2.0.2-alpha-4080120250905001",
3
+ "version": "2.0.2-alpha-4080120250919002",
4
4
  "description": "uni-cli-shared",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -27,5 +27,5 @@
27
27
  "postcss-urlrewrite": "^0.2.2",
28
28
  "strip-json-comments": "^2.0.1"
29
29
  },
30
- "gitHead": "2b970c1e601c12ec3cfa696bd0c3ee546a731434"
30
+ "gitHead": "91fa2c9eb7302c71706bf306f1e5c3df15e67a50"
31
31
  }