@dcloudio/vue-cli-plugin-uni 2.0.2-4070520250711001 → 2.0.2-4080420251103001
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/lib/chain-webpack.js +5 -5
- package/lib/configure-webpack.js +2 -1
- package/lib/env.js +31 -4
- package/lib/format-text.js +6 -3
- package/lib/h5/index.js +5 -2
- package/lib/mp/index.js +11 -9
- package/lib/util.js +61 -1
- package/package.json +3 -3
- package/packages/uni-cloud/dist/index.js +1 -1
- package/packages/uni-console/dist/__uniwebview.dev.js +556 -0
- package/packages/uni-console/dist/__uniwebview.js +1 -0
- package/packages/uni-console/dist/app.esm.js +79 -0
- package/packages/uni-console/dist/harmony.jsvm.esm.js +626 -0
- package/packages/uni-console/dist/index.esm.js +353 -273
- package/packages/uni-console/dist/mp.esm.js +653 -0
- package/packages/uni-console/dist/uni-console-format.js +215 -0
- package/packages/uni-push/dist/uni-push.es.js +11 -14
- package/packages/webpack-html-inject-aliyun-plugin/index.js +74 -0
package/lib/chain-webpack.js
CHANGED
|
@@ -172,12 +172,12 @@ module.exports = function chainWebpack (platformOptions, vueOptions, api) {
|
|
|
172
172
|
'process.env.UNI_COMPILER_VERSION': JSON.stringify(process.env.UNI_COMPILER_VERSION),
|
|
173
173
|
'process.env.UNI_APP_VERSION_NAME': JSON.stringify(process.env.UNI_APP_VERSION_NAME),
|
|
174
174
|
'process.env.UNI_APP_VERSION_CODE': JSON.stringify(process.env.UNI_APP_VERSION_CODE),
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
'process.env.UNI_SOCKET_HOSTS': JSON.stringify(process.env.UNI_SOCKET_HOSTS || ''),
|
|
176
|
+
'process.env.UNI_SOCKET_PORT': JSON.stringify(process.env.UNI_SOCKET_PORT || ''),
|
|
177
|
+
'process.env.UNI_SOCKET_ID': JSON.stringify(process.env.UNI_SOCKET_ID || ''),
|
|
178
|
+
'process.env.UNI_CONSOLE_KEEP_ORIGINAL': JSON.stringify(
|
|
179
179
|
!(process.env.UNI_PLATFORM === 'mp-harmony' ||
|
|
180
|
-
|
|
180
|
+
process.env.UNI_PLATFORM === 'app-harmony')
|
|
181
181
|
)
|
|
182
182
|
}
|
|
183
183
|
if (process.env.UNI_USING_VUE3) {
|
package/lib/configure-webpack.js
CHANGED
|
@@ -368,7 +368,8 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
|
|
|
368
368
|
}),
|
|
369
369
|
vuex: require.resolve('@dcloudio/vue-cli-plugin-uni/packages/vuex3'),
|
|
370
370
|
'@vue/composition-api': require.resolve('@dcloudio/vue-cli-plugin-uni/packages/@vue/composition-api'),
|
|
371
|
-
'@dcloudio/uni-console': require.resolve('@dcloudio/vue-cli-plugin-uni/packages/uni-console/dist/
|
|
371
|
+
'@dcloudio/uni-console': require.resolve('@dcloudio/vue-cli-plugin-uni/packages/uni-console/dist/' + (
|
|
372
|
+
process.env.UNI_PLATFORM.startsWith('mp-') ? 'mp' : 'index') + '.esm.js')
|
|
372
373
|
}
|
|
373
374
|
|
|
374
375
|
if (process.env.UNI_PLATFORM.startsWith('mp')) {
|
package/lib/env.js
CHANGED
|
@@ -97,10 +97,6 @@ process.env.VUE_APP_NAME = manifestJsonObj.name
|
|
|
97
97
|
|
|
98
98
|
process.env.UNI_USING_V3_SCOPED = true
|
|
99
99
|
|
|
100
|
-
// 导出到小程序插件
|
|
101
|
-
process.env.UNI_MP_PLUGIN_EXPORT = JSON.stringify(Object.keys(platformOptions.plugins || {}).map(pluginName =>
|
|
102
|
-
platformOptions.plugins[pluginName].export))
|
|
103
|
-
|
|
104
100
|
const isH5 = !process.env.UNI_SUB_PLATFORM && process.env.UNI_PLATFORM === 'h5'
|
|
105
101
|
const isProduction = process.env.NODE_ENV === 'production'
|
|
106
102
|
|
|
@@ -302,6 +298,37 @@ process.UNI_STAT_CONFIG = {
|
|
|
302
298
|
appid: manifestJsonObj.appid
|
|
303
299
|
}
|
|
304
300
|
|
|
301
|
+
// 导出到小程序插件
|
|
302
|
+
const mpPluginExports = Object.keys(platformOptions.plugins || {}).map(
|
|
303
|
+
pluginName => platformOptions.plugins[pluginName].export
|
|
304
|
+
)
|
|
305
|
+
// 小程序分包导出到插件
|
|
306
|
+
if (process.env.UNI_PLATFORM.indexOf('mp-') > -1 && Array.isArray(pagesJsonObj.subPackages)) {
|
|
307
|
+
pagesJsonObj.subPackages.forEach(subPackage => {
|
|
308
|
+
if (subPackage && subPackage.plugins) {
|
|
309
|
+
Object.keys(subPackage.plugins).forEach(pluginName => {
|
|
310
|
+
const plugin = subPackage.plugins[pluginName]
|
|
311
|
+
if (plugin.export) {
|
|
312
|
+
const pluginExportFileRelative = path.join(subPackage.root, plugin.export)
|
|
313
|
+
const pluginExportFile = path.resolve(process.env.UNI_INPUT_DIR, pluginExportFileRelative)
|
|
314
|
+
if (!fs.existsSync(pluginExportFile)) {
|
|
315
|
+
console.log()
|
|
316
|
+
console.error(
|
|
317
|
+
uniI18n.__('pluginUni.entryDileNoExistsCheckAfterRetry', {
|
|
318
|
+
0: pluginExportFile
|
|
319
|
+
})
|
|
320
|
+
)
|
|
321
|
+
console.log()
|
|
322
|
+
process.exit(0)
|
|
323
|
+
}
|
|
324
|
+
mpPluginExports.push(pluginExportFileRelative)
|
|
325
|
+
}
|
|
326
|
+
})
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
}
|
|
330
|
+
process.env.UNI_MP_PLUGIN_EXPORT = JSON.stringify(mpPluginExports)
|
|
331
|
+
|
|
305
332
|
// 默认启用 自定义组件模式
|
|
306
333
|
// if (isInHBuilderXAlpha) {
|
|
307
334
|
let usingComponentsAbsent = false
|
package/lib/format-text.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { condense } = require('./util')
|
|
2
|
+
|
|
1
3
|
var validDivisionCharRE = /[\w).+\-_$\]]/
|
|
2
4
|
|
|
3
5
|
function parseFilters (exp) {
|
|
@@ -74,7 +76,7 @@ function parseFilters (exp) {
|
|
|
74
76
|
break // }
|
|
75
77
|
}
|
|
76
78
|
if (c === 0x2f) { // /
|
|
77
|
-
var j = i - 1
|
|
79
|
+
var j = i - 1
|
|
78
80
|
/* eslint-disable no-void */
|
|
79
81
|
var p = (void 0)
|
|
80
82
|
// find first non-whitespace prev char
|
|
@@ -164,7 +166,8 @@ module.exports = {
|
|
|
164
166
|
if (children && children.length) {
|
|
165
167
|
children.forEach(childEl => {
|
|
166
168
|
if (childEl.text) {
|
|
167
|
-
|
|
169
|
+
// fix: 和 vue3 一致压缩空白行为,防止去除 等空白符
|
|
170
|
+
const text = condense(childEl.text)
|
|
168
171
|
if (childEl.type === 2) {
|
|
169
172
|
try {
|
|
170
173
|
const {
|
|
@@ -185,4 +188,4 @@ module.exports = {
|
|
|
185
188
|
}
|
|
186
189
|
return ''
|
|
187
190
|
}
|
|
188
|
-
}
|
|
191
|
+
}
|
package/lib/h5/index.js
CHANGED
|
@@ -18,8 +18,10 @@ const {
|
|
|
18
18
|
const modifyVueLoader = require('../vue-loader')
|
|
19
19
|
|
|
20
20
|
const WebpackHtmlAppendPlugin = require('../../packages/webpack-html-append-plugin')
|
|
21
|
-
|
|
22
21
|
const WebpackUniAppPlugin = require('../../packages/webpack-uni-app-loader/plugin/index')
|
|
22
|
+
const WebpackHtmlInjectAliYunPlugin = require('../../packages/webpack-html-inject-aliyun-plugin/index')
|
|
23
|
+
|
|
24
|
+
const { AliYunCloudAuthWebSDK } = require('../util')
|
|
23
25
|
|
|
24
26
|
function resolve (dir) {
|
|
25
27
|
return path.resolve(__dirname, '../../', dir)
|
|
@@ -51,7 +53,8 @@ function getProvides () {
|
|
|
51
53
|
|
|
52
54
|
const plugins = [
|
|
53
55
|
new WebpackUniAppPlugin(),
|
|
54
|
-
new webpack.ProvidePlugin(getProvides())
|
|
56
|
+
new webpack.ProvidePlugin(getProvides()),
|
|
57
|
+
new WebpackHtmlInjectAliYunPlugin(AliYunCloudAuthWebSDK)
|
|
55
58
|
]
|
|
56
59
|
|
|
57
60
|
if (process.env.NODE_ENV !== 'production') {
|
package/lib/mp/index.js
CHANGED
|
@@ -201,15 +201,17 @@ module.exports = {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
{
|
|
204
|
-
const globalEnv = process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx'
|
|
205
|
-
|
|
206
|
-
process.env.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
204
|
+
const globalEnv = process.env.UNI_PLATFORM === 'mp-alipay' ? 'my' : 'wx'
|
|
205
|
+
if (process.env.UNI_MP_PLUGIN) {
|
|
206
|
+
addToUniEntry(process.env.UNI_MP_PLUGIN_MAIN)
|
|
207
|
+
} else if (process.env.UNI_MP_PLUGIN_EXPORT) {
|
|
208
|
+
let exportFiles = JSON.parse(process.env.UNI_MP_PLUGIN_EXPORT)
|
|
209
|
+
if (typeof exportFiles === 'string') {
|
|
210
|
+
exportFiles = [exportFiles]
|
|
211
|
+
}
|
|
212
|
+
exportFiles.forEach(fileName => addToUniEntry(fileName))
|
|
213
|
+
}
|
|
214
|
+
beforeCode += `\n// @ts-ignore\n${globalEnv}.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;`
|
|
213
215
|
}
|
|
214
216
|
|
|
215
217
|
const alias = { // 仅 mp-weixin
|
package/lib/util.js
CHANGED
|
@@ -5,6 +5,9 @@ const {
|
|
|
5
5
|
pathToGlob
|
|
6
6
|
} = require('@dcloudio/uni-cli-shared/lib/util')
|
|
7
7
|
|
|
8
|
+
function isWhitespace (c) {
|
|
9
|
+
return c === 32 /** SPACE */ || c === 10 /** NewLine */ || c === 9 /** Tab */ || c === 12 /** FormFeed */ || c === 13 /** CarriageReturn */
|
|
10
|
+
}
|
|
8
11
|
let partialIdentifier = false
|
|
9
12
|
module.exports = {
|
|
10
13
|
getPartialIdentifier () {
|
|
@@ -115,5 +118,62 @@ module.exports = {
|
|
|
115
118
|
)
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
|
-
}
|
|
121
|
+
},
|
|
122
|
+
/**
|
|
123
|
+
* 压缩字符串空白字符
|
|
124
|
+
* - 连续空白合并为单个空格
|
|
125
|
+
* - 根据 trimSide 控制只处理左侧或右侧空白
|
|
126
|
+
*
|
|
127
|
+
* @param {string} str - 待处理字符串
|
|
128
|
+
* @param {'left'|'right'|'both'|'none'} trimSide - 压缩的方向
|
|
129
|
+
* @returns {string} 处理后的字符串
|
|
130
|
+
*/
|
|
131
|
+
condense (str, trimSide = 'both') {
|
|
132
|
+
const len = str.length
|
|
133
|
+
let ret = ''
|
|
134
|
+
let prevCharIsWhitespace = false
|
|
135
|
+
|
|
136
|
+
let firstNonWhitespace = 0
|
|
137
|
+
while (firstNonWhitespace < len && isWhitespace(str.charCodeAt(firstNonWhitespace))) {
|
|
138
|
+
firstNonWhitespace++
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let lastNonWhitespace = len - 1
|
|
142
|
+
while (lastNonWhitespace >= 0 && isWhitespace(str.charCodeAt(lastNonWhitespace))) {
|
|
143
|
+
lastNonWhitespace--
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
for (let i = 0; i < len; i++) {
|
|
147
|
+
const code = str.charCodeAt(i)
|
|
148
|
+
|
|
149
|
+
if (isWhitespace(code)) {
|
|
150
|
+
let shouldCondense = false
|
|
151
|
+
|
|
152
|
+
if (trimSide === 'both') {
|
|
153
|
+
shouldCondense = true
|
|
154
|
+
} else if (trimSide === 'left') {
|
|
155
|
+
if (i <= firstNonWhitespace) shouldCondense = true
|
|
156
|
+
} else if (trimSide === 'right') {
|
|
157
|
+
if (i >= lastNonWhitespace) shouldCondense = true
|
|
158
|
+
} else {
|
|
159
|
+
shouldCondense = false // none
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (shouldCondense) {
|
|
163
|
+
if (!prevCharIsWhitespace) {
|
|
164
|
+
ret += ' '
|
|
165
|
+
prevCharIsWhitespace = true
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
ret += str[i]
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
ret += str[i]
|
|
172
|
+
prevCharIsWhitespace = false
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return ret
|
|
177
|
+
},
|
|
178
|
+
AliYunCloudAuthWebSDK: 'https://cn-shanghai-aliyun-cloudauth.oss-cn-shanghai.aliyuncs.com/web_sdk_js/jsvm_all.js'
|
|
119
179
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/vue-cli-plugin-uni",
|
|
3
|
-
"version": "2.0.2-
|
|
3
|
+
"version": "2.0.2-4080420251103001",
|
|
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.2-
|
|
20
|
+
"@dcloudio/uni-stat": "^2.0.2-4080420251103001",
|
|
21
21
|
"buffer-json": "^2.0.0",
|
|
22
22
|
"clone-deep": "^4.0.1",
|
|
23
23
|
"cross-env": "^5.2.0",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"copy-webpack-plugin": ">=5",
|
|
42
42
|
"postcss": ">=7"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "45cefdc25bd7f68367e86074eb16962b0cb8221d"
|
|
45
45
|
}
|