@dcloudio/uni-app-plus 3.0.0-alpha-3000020210914001 → 3.0.0-alpha-3020920210927001
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/dist/style.css +1 -1
- package/dist/tools.umd.js +2 -2
- package/dist/uni-app-service.es.js +77 -82
- package/dist/uni-app-view.umd.js +1 -1
- package/lib/automator.js +724 -990
- package/lib/uni.automator.js +238 -316
- package/package.json +3 -3
package/lib/uni.automator.js
CHANGED
|
@@ -1,259 +1,206 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex
|
|
2
|
+
function t(t) {
|
|
3
|
+
return t && 'object' == typeof t && 'default' in t ? t.default : t
|
|
5
4
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
require('
|
|
15
|
-
require('
|
|
16
|
-
require('licia/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (value === 'page') {
|
|
24
|
-
//@ts-ignore
|
|
25
|
-
{
|
|
26
|
-
selector.value = 'body'
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
selector.value = 'uni-' + value
|
|
30
|
-
}
|
|
5
|
+
var e = t(require('fs')),
|
|
6
|
+
s = t(require('debug')),
|
|
7
|
+
i = t(require('postcss-selector-parser')),
|
|
8
|
+
r = t(require('fs-extra')),
|
|
9
|
+
a = t(require('licia/dateFormat')),
|
|
10
|
+
n = require('path'),
|
|
11
|
+
o = require('util')
|
|
12
|
+
require('address'),
|
|
13
|
+
require('default-gateway'),
|
|
14
|
+
require('licia/isStr'),
|
|
15
|
+
require('licia/getPort')
|
|
16
|
+
s('automator:devtool')
|
|
17
|
+
function l(t) {
|
|
18
|
+
t.walk((t) => {
|
|
19
|
+
if ('tag' === t.type) {
|
|
20
|
+
const e = t.value
|
|
21
|
+
t.value = 'page' === e ? 'body' : 'uni-' + e
|
|
31
22
|
}
|
|
32
23
|
})
|
|
33
24
|
}
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
reflect: async (send, params) => send(method, params, false),
|
|
37
|
-
params(params) {
|
|
38
|
-
if (params.selector) {
|
|
39
|
-
params.selector = parser(transform).processSync(params.selector)
|
|
40
|
-
}
|
|
41
|
-
return params
|
|
42
|
-
},
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const methods = [
|
|
25
|
+
const c = [
|
|
46
26
|
'Page.getElement',
|
|
47
27
|
'Page.getElements',
|
|
48
28
|
'Element.getElement',
|
|
49
29
|
'Element.getElements',
|
|
50
30
|
]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const debugLauncher = debug('automator:launcher')
|
|
63
|
-
const APPID = 'HBuilder'
|
|
64
|
-
const PACKAGE = 'io.dcloud.HBuilder'
|
|
65
|
-
const readdir = util.promisify(fs.readdir)
|
|
66
|
-
const stat = util.promisify(fs.stat)
|
|
67
|
-
async function getFiles(dir) {
|
|
68
|
-
const subdirs = await readdir(dir)
|
|
69
|
-
const files = await Promise.all(
|
|
70
|
-
subdirs.map(async (subdir) => {
|
|
71
|
-
const res = path.resolve(dir, subdir)
|
|
72
|
-
return (await stat(res)).isDirectory() ? getFiles(res) : res
|
|
73
|
-
})
|
|
74
|
-
)
|
|
75
|
-
return files.reduce((a, f) => a.concat(f), [])
|
|
76
|
-
}
|
|
77
|
-
class Launcher {
|
|
78
|
-
constructor(options) {
|
|
79
|
-
this.id = options.id
|
|
80
|
-
this.app = options.executablePath
|
|
81
|
-
this.appid = options.appid || APPID
|
|
82
|
-
this.package = options.package || PACKAGE
|
|
31
|
+
require('qrcode-terminal'), require('qrcode-reader')
|
|
32
|
+
const h = /^win/.test(process.platform),
|
|
33
|
+
u = s('automator:launcher'),
|
|
34
|
+
d = o.promisify(e.readdir),
|
|
35
|
+
p = o.promisify(e.stat)
|
|
36
|
+
class m {
|
|
37
|
+
constructor(t) {
|
|
38
|
+
;(this.id = t.id),
|
|
39
|
+
(this.app = t.executablePath),
|
|
40
|
+
(this.appid = t.appid || 'HBuilder'),
|
|
41
|
+
(this.package = t.package || 'io.dcloud.HBuilder')
|
|
83
42
|
}
|
|
84
43
|
shouldPush() {
|
|
85
44
|
return this.exists(this.FILE_APP_SERVICE)
|
|
86
|
-
.then(
|
|
87
|
-
|
|
88
|
-
`${
|
|
89
|
-
this.FILE_APP_SERVICE
|
|
90
|
-
} exists`
|
|
45
|
+
.then(
|
|
46
|
+
() => (
|
|
47
|
+
u(`${a('yyyy-mm-dd HH:MM:ss:l')} ${this.FILE_APP_SERVICE} exists`), !1
|
|
91
48
|
)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
49
|
+
)
|
|
50
|
+
.catch(
|
|
51
|
+
() => (
|
|
52
|
+
u(
|
|
53
|
+
`${a('yyyy-mm-dd HH:MM:ss:l')} ${this.FILE_APP_SERVICE} not exists`
|
|
54
|
+
),
|
|
55
|
+
!0
|
|
99
56
|
)
|
|
100
|
-
|
|
101
|
-
})
|
|
57
|
+
)
|
|
102
58
|
}
|
|
103
|
-
push(
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
59
|
+
push(t) {
|
|
60
|
+
return (async function t(e) {
|
|
61
|
+
const s = await d(e)
|
|
62
|
+
return (
|
|
63
|
+
await Promise.all(
|
|
64
|
+
s.map(async (s) => {
|
|
65
|
+
const i = n.resolve(e, s)
|
|
66
|
+
return (await p(i)).isDirectory() ? t(i) : i
|
|
67
|
+
})
|
|
68
|
+
)
|
|
69
|
+
).reduce((t, e) => t.concat(e), [])
|
|
70
|
+
})(t)
|
|
71
|
+
.then((e) => {
|
|
72
|
+
const s = e.map((e) => {
|
|
73
|
+
const s = ((t) => (h ? t.replace(/\\/g, '/') : t))(
|
|
74
|
+
n.join(this.DIR_WWW, n.relative(t, e))
|
|
109
75
|
)
|
|
110
|
-
|
|
111
|
-
`${
|
|
76
|
+
return (
|
|
77
|
+
u(`${a('yyyy-mm-dd HH:MM:ss:l')} push ${e} ${s}`),
|
|
78
|
+
this.pushFile(e, s)
|
|
112
79
|
)
|
|
113
|
-
return this.pushFile(file, to)
|
|
114
80
|
})
|
|
115
|
-
return Promise.all(
|
|
81
|
+
return Promise.all(s)
|
|
116
82
|
})
|
|
117
|
-
.then((
|
|
83
|
+
.then((t) => !0)
|
|
118
84
|
}
|
|
119
85
|
get FILE_APP_SERVICE() {
|
|
120
|
-
return
|
|
86
|
+
return this.DIR_WWW + '/app-service.js'
|
|
121
87
|
}
|
|
122
88
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return num > 9 ? String(num) : '0' + num
|
|
89
|
+
const y = s('automator:simctl')
|
|
90
|
+
function f(t) {
|
|
91
|
+
const e = parseInt(t)
|
|
92
|
+
return e > 9 ? String(e) : '0' + e
|
|
128
93
|
}
|
|
129
|
-
class
|
|
94
|
+
class g extends m {
|
|
130
95
|
constructor() {
|
|
131
|
-
super(...arguments)
|
|
132
|
-
this.bundleVersion = ''
|
|
96
|
+
super(...arguments), (this.bundleVersion = '')
|
|
133
97
|
}
|
|
134
98
|
async init() {
|
|
135
|
-
const
|
|
136
|
-
this.tool = new
|
|
99
|
+
const t = require('node-simctl').Simctl
|
|
100
|
+
this.tool = new t({ udid: this.id })
|
|
137
101
|
try {
|
|
138
102
|
await this.tool.bootDevice()
|
|
139
|
-
} catch (
|
|
140
|
-
await this.initSDCard()
|
|
141
|
-
debugClient(`${dateFormat('yyyy-mm-dd HH:MM:ss:l')} init ${this.id}`)
|
|
103
|
+
} catch (t) {}
|
|
104
|
+
await this.initSDCard(), y(`${a('yyyy-mm-dd HH:MM:ss:l')} init ${this.id}`)
|
|
142
105
|
}
|
|
143
106
|
async initSDCard() {
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
if (!
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
this.sdcard = matches[1].replace('file:', '')
|
|
155
|
-
this.bundleVersion = versionMatches[1]
|
|
156
|
-
debugClient(`${dateFormat('yyyy-mm-dd HH:MM:ss:l')} install ${this.sdcard}`)
|
|
107
|
+
const t = await this.tool.appInfo(this.package)
|
|
108
|
+
y(`${a('yyyy-mm-dd HH:MM:ss:l')} appInfo ${t}`)
|
|
109
|
+
const e = t.match(/DataContainer\s+=\s+"(.*)"/)
|
|
110
|
+
if (!e) return Promise.resolve('')
|
|
111
|
+
const s = t.match(/CFBundleVersion\s+=\s+(.*);/)
|
|
112
|
+
if (!s) return Promise.resolve('')
|
|
113
|
+
;(this.sdcard = e[1].replace('file:', '')),
|
|
114
|
+
(this.bundleVersion = s[1]),
|
|
115
|
+
y(`${a('yyyy-mm-dd HH:MM:ss:l')} install ${this.sdcard}`)
|
|
157
116
|
}
|
|
158
117
|
async version() {
|
|
159
118
|
return Promise.resolve(this.bundleVersion)
|
|
160
119
|
}
|
|
161
|
-
formatVersion(
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
return version
|
|
165
|
-
}
|
|
166
|
-
return versions[0] + padZero(versions[1]) + padZero(versions[2])
|
|
120
|
+
formatVersion(t) {
|
|
121
|
+
const e = t.split('.')
|
|
122
|
+
return 3 !== e.length ? t : e[0] + f(e[1]) + f(e[2])
|
|
167
123
|
}
|
|
168
124
|
async install() {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
125
|
+
return (
|
|
126
|
+
y(`${a('yyyy-mm-dd HH:MM:ss:l')} install ${this.app}`),
|
|
127
|
+
await this.tool.installApp(this.app),
|
|
128
|
+
await this.tool.grantPermission(this.package, 'all'),
|
|
129
|
+
await this.initSDCard(),
|
|
130
|
+
Promise.resolve(!0)
|
|
131
|
+
)
|
|
174
132
|
}
|
|
175
133
|
async start() {
|
|
176
134
|
try {
|
|
177
|
-
await this.tool.terminateApp(this.package)
|
|
178
|
-
|
|
179
|
-
} catch (
|
|
180
|
-
return Promise.resolve(
|
|
135
|
+
await this.tool.terminateApp(this.package),
|
|
136
|
+
await this.tool.launchApp(this.package)
|
|
137
|
+
} catch (t) {}
|
|
138
|
+
return Promise.resolve(!0)
|
|
181
139
|
}
|
|
182
140
|
async exit() {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
141
|
+
return (
|
|
142
|
+
await this.tool.terminateApp(this.package),
|
|
143
|
+
await this.tool.shutdownDevice(),
|
|
144
|
+
Promise.resolve(!0)
|
|
145
|
+
)
|
|
186
146
|
}
|
|
187
147
|
async captureScreenshot() {
|
|
188
148
|
return Promise.resolve(await this.tool.getScreenshot())
|
|
189
149
|
}
|
|
190
|
-
exists(
|
|
191
|
-
return
|
|
192
|
-
? Promise.resolve(
|
|
193
|
-
: Promise.reject(Error(
|
|
150
|
+
exists(t) {
|
|
151
|
+
return r.existsSync(t)
|
|
152
|
+
? Promise.resolve(!0)
|
|
153
|
+
: Promise.reject(Error(t + ' not exists'))
|
|
194
154
|
}
|
|
195
|
-
pushFile(
|
|
196
|
-
return Promise.resolve(
|
|
155
|
+
pushFile(t, e) {
|
|
156
|
+
return Promise.resolve(r.copySync(t, e))
|
|
197
157
|
}
|
|
198
158
|
get DIR_WWW() {
|
|
199
159
|
return `${this.sdcard}/Documents/Pandora/apps/${this.appid}/www/`
|
|
200
160
|
}
|
|
201
161
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const $EXTERNAL_STORAGE = '$EXTERNAL_STORAGE'
|
|
206
|
-
class Android extends Launcher {
|
|
162
|
+
const w = require('adbkit'),
|
|
163
|
+
M = s('automator:adb')
|
|
164
|
+
class P extends m {
|
|
207
165
|
async init() {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (!devices.length) {
|
|
213
|
-
throw Error(`Device not found`)
|
|
214
|
-
}
|
|
215
|
-
this.id = devices[0].id
|
|
166
|
+
if (((this.tool = w.createClient()), !this.id)) {
|
|
167
|
+
const t = await this.tool.listDevices()
|
|
168
|
+
if (!t.length) throw Error('Device not found')
|
|
169
|
+
this.id = t[0].id
|
|
216
170
|
}
|
|
217
|
-
this.sdcard = (await this.shell(this.COMMAND_EXTERNAL)).trim()
|
|
218
|
-
|
|
219
|
-
`${dateFormat('yyyy-mm-dd HH:MM:ss:l')} init ${this.id} ${this.sdcard}`
|
|
220
|
-
)
|
|
171
|
+
;(this.sdcard = (await this.shell(this.COMMAND_EXTERNAL)).trim()),
|
|
172
|
+
M(`${a('yyyy-mm-dd HH:MM:ss:l')} init ${this.id} ${this.sdcard}`)
|
|
221
173
|
}
|
|
222
174
|
version() {
|
|
223
|
-
return this.shell(this.COMMAND_VERSION).then((
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
return matches[1]
|
|
227
|
-
}
|
|
228
|
-
return ''
|
|
175
|
+
return this.shell(this.COMMAND_VERSION).then((t) => {
|
|
176
|
+
const e = t.match(/versionName=(.*)/)
|
|
177
|
+
return e && e.length > 1 ? e[1] : ''
|
|
229
178
|
})
|
|
230
179
|
}
|
|
231
|
-
formatVersion(
|
|
232
|
-
return
|
|
180
|
+
formatVersion(t) {
|
|
181
|
+
return t
|
|
233
182
|
}
|
|
234
183
|
async install() {
|
|
235
|
-
let
|
|
184
|
+
let t = !0
|
|
236
185
|
try {
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
return oldSend.call(this, data)
|
|
186
|
+
const e = (await this.tool.getProperties(this.id))[
|
|
187
|
+
'ro.build.version.release'
|
|
188
|
+
].split('.')[0]
|
|
189
|
+
parseInt(e) < 6 && (t = !1)
|
|
190
|
+
} catch (t) {}
|
|
191
|
+
if (
|
|
192
|
+
(M(`${a('yyyy-mm-dd HH:MM:ss:l')} install ${this.app} permission=${t}`),
|
|
193
|
+
t)
|
|
194
|
+
) {
|
|
195
|
+
const t = require('adbkit/lib/adb/command.js'),
|
|
196
|
+
e = t.prototype._send
|
|
197
|
+
t.prototype._send = function (t) {
|
|
198
|
+
return (
|
|
199
|
+
0 === t.indexOf('shell:pm install -r ') &&
|
|
200
|
+
((t = t.replace('shell:pm install -r ', 'shell:pm install -r -g ')),
|
|
201
|
+
M(`${a('yyyy-mm-dd HH:MM:ss:l')} ${t} `)),
|
|
202
|
+
e.call(this, t)
|
|
203
|
+
)
|
|
257
204
|
}
|
|
258
205
|
}
|
|
259
206
|
return this.tool.install(this.id, this.app).then(() => this.init())
|
|
@@ -265,151 +212,126 @@ class Android extends Launcher {
|
|
|
265
212
|
return this.shell(this.COMMAND_STOP)
|
|
266
213
|
}
|
|
267
214
|
captureScreenshot() {
|
|
268
|
-
return this.tool.screencap(this.id).then(
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
215
|
+
return this.tool.screencap(this.id).then(
|
|
216
|
+
(t) =>
|
|
217
|
+
new Promise((e) => {
|
|
218
|
+
const s = []
|
|
219
|
+
t.on('data', function (t) {
|
|
220
|
+
s.push(t)
|
|
221
|
+
}),
|
|
222
|
+
t.on('end', function () {
|
|
223
|
+
e(Buffer.concat(s).toString('base64'))
|
|
224
|
+
})
|
|
276
225
|
})
|
|
277
|
-
|
|
278
|
-
})
|
|
279
|
-
}
|
|
280
|
-
exists(file) {
|
|
281
|
-
return this.tool.stat(this.id, file)
|
|
282
|
-
}
|
|
283
|
-
pushFile(from, to) {
|
|
284
|
-
return this.tool.push(this.id, from, to)
|
|
226
|
+
)
|
|
285
227
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
228
|
+
exists(t) {
|
|
229
|
+
return this.tool.stat(this.id, t)
|
|
230
|
+
}
|
|
231
|
+
pushFile(t, e) {
|
|
232
|
+
return this.tool.push(this.id, t, e)
|
|
233
|
+
}
|
|
234
|
+
shell(t) {
|
|
235
|
+
return (
|
|
236
|
+
M(`${a('yyyy-mm-dd HH:MM:ss:l')} SEND ► ${t}`),
|
|
237
|
+
this.tool
|
|
238
|
+
.shell(this.id, t)
|
|
239
|
+
.then(w.util.readAll)
|
|
240
|
+
.then((t) => {
|
|
241
|
+
const e = t.toString()
|
|
242
|
+
return M(`${a('yyyy-mm-dd HH:MM:ss:l')} ◀ RECV ${e}`), e
|
|
243
|
+
})
|
|
244
|
+
)
|
|
296
245
|
}
|
|
297
246
|
get DIR_WWW() {
|
|
298
247
|
return `${this.sdcard}/Android/data/${this.package}/apps/${this.appid}/www`
|
|
299
248
|
}
|
|
300
249
|
get COMMAND_EXTERNAL() {
|
|
301
|
-
return
|
|
250
|
+
return 'echo $EXTERNAL_STORAGE'
|
|
302
251
|
}
|
|
303
252
|
get COMMAND_VERSION() {
|
|
304
|
-
return
|
|
253
|
+
return 'dumpsys package ' + this.package
|
|
305
254
|
}
|
|
306
255
|
get COMMAND_STOP() {
|
|
307
|
-
return
|
|
256
|
+
return 'am force-stop ' + this.package
|
|
308
257
|
}
|
|
309
258
|
get COMMAND_START() {
|
|
310
259
|
return `am start -n ${this.package}/io.dcloud.PandoraEntry --es ${this.appid} --ez needUpdateApp false --ez reload true`
|
|
311
260
|
}
|
|
312
261
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
return new Android(options)
|
|
322
|
-
}
|
|
323
|
-
const VERSIONS_RE = {
|
|
324
|
-
android: /android_version=(.*)/,
|
|
325
|
-
ios: /iphone_version=(.*)/,
|
|
326
|
-
}
|
|
327
|
-
function getVersion(version, platform) {
|
|
328
|
-
if (version.endsWith('.txt')) {
|
|
329
|
-
try {
|
|
330
|
-
const versionStr = fs.readFileSync(version).toString()
|
|
331
|
-
const matches = versionStr.match(VERSIONS_RE[platform])
|
|
332
|
-
if (matches) {
|
|
333
|
-
return matches[1]
|
|
334
|
-
}
|
|
335
|
-
} catch (e) {
|
|
336
|
-
console.error(e)
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
return version
|
|
340
|
-
}
|
|
341
|
-
async function validateDevtools(options, puppet) {
|
|
342
|
-
options.platform = (
|
|
343
|
-
options.platform || process.env.UNI_OS_NAME
|
|
344
|
-
).toLocaleLowerCase()
|
|
345
|
-
Object.assign(options, options[options.platform])
|
|
346
|
-
launcher = createLauncher(options.platform, options)
|
|
347
|
-
await launcher.init() // check device
|
|
348
|
-
const version = await launcher.version()
|
|
349
|
-
if (!version) {
|
|
350
|
-
install = true
|
|
351
|
-
} else if (options.version) {
|
|
352
|
-
const newVersion = launcher.formatVersion(
|
|
353
|
-
getVersion(options.version, options.platform)
|
|
354
|
-
)
|
|
355
|
-
debugDevtools(`version: ${version}`)
|
|
356
|
-
debugDevtools(`newVersion: ${newVersion}`)
|
|
357
|
-
if (newVersion !== version) {
|
|
358
|
-
install = true
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (install) {
|
|
362
|
-
if (!options.executablePath) {
|
|
363
|
-
throw Error(
|
|
364
|
-
`app-plus->${options.platform}->executablePath is not provided`
|
|
365
|
-
)
|
|
366
|
-
}
|
|
367
|
-
if (!fs.existsSync(options.executablePath)) {
|
|
368
|
-
throw Error(`${options.executablePath} not exists`)
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
return options
|
|
372
|
-
}
|
|
373
|
-
async function createDevtools(projectPath, options, puppet) {
|
|
374
|
-
if (install) {
|
|
375
|
-
//install
|
|
376
|
-
await launcher.install()
|
|
377
|
-
}
|
|
378
|
-
if (install || puppet.compiled || (await launcher.shouldPush())) {
|
|
379
|
-
await launcher.push(projectPath)
|
|
380
|
-
}
|
|
381
|
-
await launcher.start()
|
|
382
|
-
}
|
|
383
|
-
const adapter = {
|
|
384
|
-
'Tool.close': {
|
|
385
|
-
reflect: async () => {},
|
|
386
|
-
},
|
|
387
|
-
'App.exit': {
|
|
388
|
-
reflect: async () => launcher.exit(),
|
|
389
|
-
},
|
|
390
|
-
'App.enableLog': {
|
|
391
|
-
reflect: () => Promise.resolve(),
|
|
392
|
-
},
|
|
262
|
+
const v = s('automator:devtool')
|
|
263
|
+
let E,
|
|
264
|
+
$ = !1
|
|
265
|
+
const S = { android: /android_version=(.*)/, ios: /iphone_version=(.*)/ }
|
|
266
|
+
const A = {
|
|
267
|
+
'Tool.close': { reflect: async () => {} },
|
|
268
|
+
'App.exit': { reflect: async () => E.exit() },
|
|
269
|
+
'App.enableLog': { reflect: () => Promise.resolve() },
|
|
393
270
|
'App.captureScreenshot': {
|
|
394
|
-
reflect: async (
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
return {
|
|
398
|
-
data,
|
|
399
|
-
}
|
|
271
|
+
reflect: async (t, e) => {
|
|
272
|
+
const s = await E.captureScreenshot(e)
|
|
273
|
+
return v('App.captureScreenshot ' + s.length), { data: s }
|
|
400
274
|
},
|
|
401
275
|
},
|
|
402
276
|
}
|
|
403
|
-
|
|
404
|
-
|
|
277
|
+
!(function (t) {
|
|
278
|
+
c.forEach((e) => {
|
|
279
|
+
t[e] = (function (t) {
|
|
280
|
+
return {
|
|
281
|
+
reflect: async (e, s) => e(t, s, !1),
|
|
282
|
+
params: (t) => (
|
|
283
|
+
t.selector && (t.selector = i(l).processSync(t.selector)), t
|
|
284
|
+
),
|
|
285
|
+
}
|
|
286
|
+
})(e)
|
|
287
|
+
})
|
|
288
|
+
})(A)
|
|
289
|
+
const _ = {
|
|
405
290
|
devtools: {
|
|
406
291
|
name: 'App',
|
|
407
292
|
paths: [],
|
|
408
293
|
required: ['manifest.json', 'app-service.js'],
|
|
409
|
-
validate:
|
|
410
|
-
|
|
294
|
+
validate: async function (t, s) {
|
|
295
|
+
;(t.platform = (
|
|
296
|
+
t.platform || process.env.UNI_OS_NAME
|
|
297
|
+
).toLocaleLowerCase()),
|
|
298
|
+
Object.assign(t, t[t.platform]),
|
|
299
|
+
(E = (function (t, e) {
|
|
300
|
+
return 'ios' === t ? new g(e) : new P(e)
|
|
301
|
+
})(t.platform, t)),
|
|
302
|
+
await E.init()
|
|
303
|
+
const i = await E.version()
|
|
304
|
+
if (i) {
|
|
305
|
+
if (t.version) {
|
|
306
|
+
const s = E.formatVersion(
|
|
307
|
+
(function (t, s) {
|
|
308
|
+
if (t.endsWith('.txt'))
|
|
309
|
+
try {
|
|
310
|
+
const i = e.readFileSync(t).toString().match(S[s])
|
|
311
|
+
if (i) return i[1]
|
|
312
|
+
} catch (t) {
|
|
313
|
+
console.error(t)
|
|
314
|
+
}
|
|
315
|
+
return t
|
|
316
|
+
})(t.version, t.platform)
|
|
317
|
+
)
|
|
318
|
+
v('version: ' + i), v('newVersion: ' + s), s !== i && ($ = !0)
|
|
319
|
+
}
|
|
320
|
+
} else $ = !0
|
|
321
|
+
if ($) {
|
|
322
|
+
if (!t.executablePath)
|
|
323
|
+
throw Error(`app-plus->${t.platform}->executablePath is not provided`)
|
|
324
|
+
if (!e.existsSync(t.executablePath))
|
|
325
|
+
throw Error(t.executablePath + ' not exists')
|
|
326
|
+
}
|
|
327
|
+
return t
|
|
328
|
+
},
|
|
329
|
+
create: async function (t, e, s) {
|
|
330
|
+
$ && (await E.install()),
|
|
331
|
+
($ || s.compiled || (await E.shouldPush())) && (await E.push(t)),
|
|
332
|
+
await E.start()
|
|
333
|
+
},
|
|
411
334
|
},
|
|
412
|
-
adapter,
|
|
335
|
+
adapter: A,
|
|
413
336
|
}
|
|
414
|
-
|
|
415
|
-
module.exports = puppet
|
|
337
|
+
module.exports = _
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-app-plus",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-3020920210927001",
|
|
4
4
|
"description": "@dcloudio/uni-app-plus",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"url": "https://github.com/dcloudio/uni-app/issues"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"vue": "^3.2.
|
|
23
|
+
"vue": "^3.2.19"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "549c7f3fe68aa81496713db2567a847eeb49c0d7"
|
|
26
26
|
}
|