@dcloudio/vue-cli-plugin-uni 2.0.1-alpha-35220220719002 → 2.0.1-alpha-35320220727002

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.
package/commands/build.js CHANGED
@@ -35,7 +35,8 @@ module.exports = (api, options) => {
35
35
  '--auto-port': 'specify automator port',
36
36
  '--subpackage': 'specify subpackage',
37
37
  '--plugin': 'specify mp plugin',
38
- '--manifest': 'build manifest.json'
38
+ '--manifest': 'build manifest.json',
39
+ '--sourcemap': 'generate sourcemap'
39
40
  }
40
41
  }, async (args) => {
41
42
  for (const key in defaults) {
@@ -72,6 +73,8 @@ module.exports = (api, options) => {
72
73
 
73
74
  process.env.VUE_CLI_BUILD_TARGET = args.target
74
75
 
76
+ if (args.sourcemap) process.env.SOURCEMAP = args.sourcemap
77
+
75
78
  await build(args, api, options)
76
79
 
77
80
  delete process.env.VUE_CLI_BUILD_TARGET
package/generator.js CHANGED
@@ -69,6 +69,7 @@ module.exports = (api, options, rootOptions) => {
69
69
  '@dcloudio/uni-quickapp-webview': version,
70
70
  '@dcloudio/uni-stat': version,
71
71
  '@dcloudio/uni-i18n': version,
72
+ '@dcloudio/uni-stacktracey': version,
72
73
  '@vue/shared': '^3.0.0',
73
74
  flyio: '^0.6.2',
74
75
  vuex: '^3.2.0'
@@ -33,7 +33,8 @@ module.exports = function custom (argv) {
33
33
  minimize: process.env.UNI_MINIMIZE === 'true',
34
34
  clean: false,
35
35
  subpackage: argv.subpackage,
36
- plugin: argv.plugin
36
+ plugin: argv.plugin,
37
+ sourcemap: argv.sourcemap
37
38
  }).catch(err => {
38
39
  console.error(err)
39
40
  process.exit(1)
@@ -267,7 +267,7 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
267
267
  })
268
268
  }
269
269
 
270
- if (process.env.NODE_ENV === 'development') {
270
+ if (process.env.NODE_ENV === 'development' || (process.env.NODE_ENV === 'production' && process.env.SOURCEMAP === 'true')) {
271
271
  const sourceMap = require('@dcloudio/uni-cli-shared/lib/source-map')
272
272
  let isAppService = false
273
273
  if (
@@ -277,15 +277,28 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
277
277
  ) {
278
278
  isAppService = !!vueOptions.pluginOptions['uni-app-plus'].service
279
279
  }
280
- if (process.env.UNI_PLATFORM === 'h5' || isAppService) {
281
- plugins.push(sourceMap.createEvalSourceMapDevToolPlugin())
282
- } else if (
283
- process.env.UNI_PLATFORM.indexOf('mp-') === 0 &&
280
+
281
+ const useEvalSourceMap = process.env.UNI_PLATFORM === 'h5' || isAppService
282
+ const useSourceMap = process.env.UNI_PLATFORM.indexOf('mp-') === 0 &&
284
283
  process.env.UNI_PLATFORM !== 'mp-baidu' &&
285
284
  process.env.UNI_PLATFORM !== 'mp-alipay' &&
286
285
  process.env.UNI_PLATFORM !== 'quickapp-webview' // 目前 ov 的开发工具支持 eval 模式
287
- ) {
288
- plugins.push(sourceMap.createSourceMapDevToolPlugin(process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'mp-toutiao'))
286
+
287
+ if (process.env.NODE_ENV === 'production') {
288
+ const sourceMapOptions = {
289
+ noSources: true,
290
+ append: false
291
+ }
292
+ if (isInHBuilderX && process.env.SOURCEMAP_PATH) { sourceMapOptions.filename = process.env.SOURCEMAP_PATH }
293
+ if (useEvalSourceMap || useSourceMap) {
294
+ plugins.push(sourceMap.createSourceMapDevToolPlugin(!sourceMapOptions.filename, sourceMapOptions))
295
+ }
296
+ } else {
297
+ if (useEvalSourceMap) {
298
+ plugins.push(sourceMap.createEvalSourceMapDevToolPlugin())
299
+ } else if (useSourceMap) {
300
+ plugins.push(sourceMap.createSourceMapDevToolPlugin(process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'mp-toutiao'))
301
+ }
289
302
  }
290
303
  }
291
304
 
@@ -351,4 +364,4 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
351
364
  watchOptions: require('./util').getWatchOptions()
352
365
  }, platformWebpackConfig)
353
366
  }
354
- }
367
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-uni",
3
- "version": "2.0.1-alpha-35220220719002",
3
+ "version": "2.0.1-alpha-35320220727002",
4
4
  "description": "uni-app plugin for vue-cli 3",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "author": "fxy060608",
18
18
  "license": "Apache-2.0",
19
19
  "dependencies": {
20
- "@dcloudio/uni-stat": "^2.0.1-alpha-35220220719002",
20
+ "@dcloudio/uni-stat": "^2.0.1-alpha-35320220727002",
21
21
  "buffer-json": "^2.0.0",
22
22
  "clone-deep": "^4.0.1",
23
23
  "copy-webpack-plugin": "^5.1.1",
@@ -39,5 +39,5 @@
39
39
  "wrap-loader": "^0.2.0",
40
40
  "xregexp": "4.0.0"
41
41
  },
42
- "gitHead": "6f2fdbfa632fd7b9da6cbdf4faea5ac863f0eb67"
42
+ "gitHead": "91c99b6c5328a5844d3f7a75637675d681ec5695"
43
43
  }
@@ -100,6 +100,26 @@ e?.onClose(t);
100
100
 
101
101
  var GtPush = /*@__PURE__*/getDefaultExportFromCjs(gtpushMin);
102
102
 
103
+ function initPushNotification() {
104
+ // 仅 App 端
105
+ if (typeof plus !== 'undefined' && plus.push) {
106
+ plus.push.addEventListener('click', (result) => {
107
+ // @ts-expect-error
108
+ uni.invokePushCallback({
109
+ type: 'click',
110
+ message: result,
111
+ });
112
+ });
113
+ uni.onPushMessage((res) => {
114
+ if (res.type === 'receive' && res.data && res.data.force_notification) {
115
+ // 创建通知栏
116
+ uni.createPushMessage(res.data);
117
+ res.stopped = true;
118
+ }
119
+ });
120
+ }
121
+ }
122
+
103
123
  // if (process.env.UNI_PUSH_DEBUG) {
104
124
  // GtPush.setDebugMode(true)
105
125
  // }
@@ -119,6 +139,7 @@ if (!appid) {
119
139
  });
120
140
  }
121
141
  else {
142
+ initPushNotification();
122
143
  GtPush.init({
123
144
  appid,
124
145
  onError: (res) => {