You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cn...@apache.org on 2021/01/23 08:23:40 UTC

[incubator-weex-cli] branch master updated: fix: use chromium to support deprecated customElements api

This is an automated email from the ASF dual-hosted git repository.

cnryb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new e598b55  fix: use chromium to support deprecated customElements api
     new 0c809dc  Merge pull request #630 from Zsynuting/master
e598b55 is described below

commit e598b55c29d69af08b7fd95db80aff6f57a17037
Author: zhushaoying <zh...@didiglobal.com>
AuthorDate: Tue Jan 19 10:49:35 2021 +0800

    fix: use chromium to support deprecated customElements api
---
 packages/@weex/plugins/debug/src/index.js          |  2 +-
 .../@weex/plugins/debug/src/link/handlers/entry.js |  2 --
 packages/@weex/plugins/debug/src/util/launcher.js  | 30 +++-------------------
 3 files changed, 4 insertions(+), 30 deletions(-)

diff --git a/packages/@weex/plugins/debug/src/index.js b/packages/@weex/plugins/debug/src/index.js
index 1e2b50a..3edf8f1 100644
--- a/packages/@weex/plugins/debug/src/index.js
+++ b/packages/@weex/plugins/debug/src/index.js
@@ -71,7 +71,7 @@ exports.launch = function (ip, port) {
       headless.launchHeadless(`${config.ip}:${config.port}`, open)
     })
   }
-  if (!config.manual) launcher.launchChrome(debuggerURL, config.REMOTE_DEBUG_PORT || 9222)
+  if (!config.manual) launcher.launchChrome(debuggerURL)
 }
 
 exports.reload = function () {
diff --git a/packages/@weex/plugins/debug/src/link/handlers/entry.js b/packages/@weex/plugins/debug/src/link/handlers/entry.js
index 9d172c6..8d46b36 100644
--- a/packages/@weex/plugins/debug/src/link/handlers/entry.js
+++ b/packages/@weex/plugins/debug/src/link/handlers/entry.js
@@ -5,8 +5,6 @@ const { util } = require('../../util')
 const debuggerRouter = Router.get('debugger')
 const opn = require('opn')
 
-
-
 let heartbeatTimer
 const sendHeartbeat = () => {
   heartbeatTimer && clearTimeout(heartbeatTimer)
diff --git a/packages/@weex/plugins/debug/src/util/launcher.js b/packages/@weex/plugins/debug/src/util/launcher.js
index c23de96..467a98d 100644
--- a/packages/@weex/plugins/debug/src/util/launcher.js
+++ b/packages/@weex/plugins/debug/src/util/launcher.js
@@ -1,31 +1,7 @@
 const opn = require('opn')
-
-const pendingList = []
-let pending = false
-const launchChrome = function (url, remoteDebugPort, wait, callback) {
-  if (!pending) {
-    pending = true
-    url = url.replace(/[&*]/g, '\\&')
-    const args = remoteDebugPort > 0 ? ['-remote-debugging-port=' + remoteDebugPort] : null
-    opn(url, args, !!wait).then(cp => {
-      cp.once('close', e => {
-        callback && callback(null)
-        if (pendingList.length > 0) {
-          pending = false
-          pendingList.shift()()
-        }
-      })
-      cp.once('error', err => {
-        pending = false
-        callback && callback(err)
-      })
-    })
-  }
-  else {
-    pendingList.push(function () {
-      launchChrome(url, remoteDebugPort, wait, callback)
-    })
-  }
+const puppeteer = require('puppeteer')
+const launchChrome = function (url) {
+  opn(url, { app: puppeteer._launcher.executablePath() })
 }
 
 module.exports = {