From fb7ccb703879e7e4b8b6237aff0c39d3e8cb66e7 Mon Sep 17 00:00:00 2001 From: xuyanfeng Date: Sat, 3 Apr 2021 11:42:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E8=AF=81=E5=9F=BA=E7=A1=80=E7=9A=84?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/.eslintrc.js | 9 ++++++- source/package-lock.json | 24 +++++++++---------- source/package.json | 3 ++- source/src/devtools/{index.js => main.ts} | 10 ++++---- .../panel/ccType/NodeBaseProperty.vue | 15 ++++++------ source/src/devtools/panel/ccType/ui-prop.vue | 13 +++++----- source/src/index.less | 6 +++-- source/src/inject.js | 2 +- source/src/manifest/index.js | 6 ++--- source/src/popup/index.ts | 1 + source/src/popup/index.vue | 12 ++++++---- source/vue.config.js | 3 ++- 12 files changed, 60 insertions(+), 44 deletions(-) rename source/src/devtools/{index.js => main.ts} (76%) diff --git a/source/.eslintrc.js b/source/.eslintrc.js index 0355140..e86d226 100644 --- a/source/.eslintrc.js +++ b/source/.eslintrc.js @@ -21,6 +21,13 @@ module.exports = { rules: { "@typescript-eslint/explicit-module-boundary-types": "off", - "@typescript-eslint/no-unused-vars": "off" + "@typescript-eslint/no-unused-vars": "off", + "prettier/prettier": "off", + "no-empty": "off", + "prefer-const": "off", + "@typescript-eslint/no-var-requires": "off", + "no-undef": "off", + "no-debugger": "off", + "no-unreachable": "off", } }; diff --git a/source/package-lock.json b/source/package-lock.json index e9f5686..dcfb127 100644 --- a/source/package-lock.json +++ b/source/package-lock.json @@ -4317,7 +4317,7 @@ }, "cosmiconfig": { "version": "6.0.0", - "resolved": "https://registry.npm.taobao.org/cosmiconfig/download/cosmiconfig-6.0.0.tgz", + "resolved": "https://registry.npm.taobao.org/cosmiconfig/download/cosmiconfig-6.0.0.tgz?cache=0&sync_timestamp=1596310819353&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcosmiconfig%2Fdownload%2Fcosmiconfig-6.0.0.tgz", "integrity": "sha1-2k/uhTxS9rHmk19BwaL8UL1KmYI=", "dev": true, "optional": true, @@ -4331,7 +4331,7 @@ "dependencies": { "path-type": { "version": "4.0.0", - "resolved": "https://registry.npm.taobao.org/path-type/download/path-type-4.0.0.tgz?cache=0&sync_timestamp=1611752074264&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpath-type%2Fdownload%2Fpath-type-4.0.0.tgz", + "resolved": "https://registry.npm.taobao.org/path-type/download/path-type-4.0.0.tgz?cache=0&sync_timestamp=1611752058913&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpath-type%2Fdownload%2Fpath-type-4.0.0.tgz", "integrity": "sha1-hO0BwKe6OAr+CdkKjBgNzZ0DBDs=", "dev": true, "optional": true @@ -4741,7 +4741,7 @@ }, "deepmerge": { "version": "4.2.2", - "resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-4.2.2.tgz", + "resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-4.2.2.tgz?cache=0&sync_timestamp=1572279720382&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdeepmerge%2Fdownload%2Fdeepmerge-4.2.2.tgz", "integrity": "sha1-RNLqNnm49NT/ujPwPYZfwee/SVU=", "dev": true, "optional": true @@ -6231,7 +6231,7 @@ }, "chalk": { "version": "4.1.0", - "resolved": "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz?cache=0&sync_timestamp=1591687076871&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-4.1.0.tgz", + "resolved": "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz?cache=0&sync_timestamp=1591687070184&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-4.1.0.tgz", "integrity": "sha1-ThSHCmGNni7dl92DRf2dncMVZGo=", "dev": true, "optional": true, @@ -6242,7 +6242,7 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz?cache=0&sync_timestamp=1566248870121&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcolor-convert%2Fdownload%2Fcolor-convert-2.0.1.tgz", + "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz", "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", "dev": true, "optional": true, @@ -6266,7 +6266,7 @@ }, "lru-cache": { "version": "6.0.0", - "resolved": "https://registry.npm.taobao.org/lru-cache/download/lru-cache-6.0.0.tgz?cache=0&sync_timestamp=1594427573763&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flru-cache%2Fdownload%2Flru-cache-6.0.0.tgz", + "resolved": "https://registry.npm.taobao.org/lru-cache/download/lru-cache-6.0.0.tgz?cache=0&sync_timestamp=1594427582110&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flru-cache%2Fdownload%2Flru-cache-6.0.0.tgz", "integrity": "sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ=", "dev": true, "optional": true, @@ -6276,7 +6276,7 @@ }, "schema-utils": { "version": "2.7.0", - "resolved": "https://registry.npm.taobao.org/schema-utils/download/schema-utils-2.7.0.tgz", + "resolved": "https://registry.npm.taobao.org/schema-utils/download/schema-utils-2.7.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fschema-utils%2Fdownload%2Fschema-utils-2.7.0.tgz", "integrity": "sha1-FxUfdtjq5n+793lgwzxnatn078c=", "dev": true, "optional": true, @@ -6379,7 +6379,7 @@ }, "fs-monkey": { "version": "1.0.1", - "resolved": "https://registry.npm.taobao.org/fs-monkey/download/fs-monkey-1.0.1.tgz", + "resolved": "https://registry.npm.taobao.org/fs-monkey/download/fs-monkey-1.0.1.tgz?cache=0&sync_timestamp=1617321543111&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffs-monkey%2Fdownload%2Ffs-monkey-1.0.1.tgz", "integrity": "sha1-SoLzaUQ2XmGfRFTZ//EGVTBnt4E=", "dev": true, "optional": true @@ -12882,7 +12882,7 @@ }, "chalk": { "version": "4.1.0", - "resolved": "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz?cache=0&sync_timestamp=1591687076871&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-4.1.0.tgz", + "resolved": "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz?cache=0&sync_timestamp=1591687070184&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-4.1.0.tgz", "integrity": "sha1-ThSHCmGNni7dl92DRf2dncMVZGo=", "dev": true, "optional": true, @@ -12893,7 +12893,7 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz?cache=0&sync_timestamp=1566248870121&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcolor-convert%2Fdownload%2Fcolor-convert-2.0.1.tgz", + "resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz", "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=", "dev": true, "optional": true, @@ -12917,7 +12917,7 @@ }, "loader-utils": { "version": "2.0.0", - "resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-2.0.0.tgz", + "resolved": "https://registry.npm.taobao.org/loader-utils/download/loader-utils-2.0.0.tgz?cache=0&sync_timestamp=1584445207623&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Floader-utils%2Fdownload%2Floader-utils-2.0.0.tgz", "integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=", "dev": true, "optional": true, @@ -13777,7 +13777,7 @@ }, "yaml": { "version": "1.10.2", - "resolved": "https://registry.npm.taobao.org/yaml/download/yaml-1.10.2.tgz?cache=0&sync_timestamp=1615677716891&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fyaml%2Fdownload%2Fyaml-1.10.2.tgz", + "resolved": "https://registry.npm.taobao.org/yaml/download/yaml-1.10.2.tgz", "integrity": "sha1-IwHF/78StGfejaIzOkWeKeeSDks=", "dev": true, "optional": true diff --git a/source/package.json b/source/package.json index f51a306..6962069 100644 --- a/source/package.json +++ b/source/package.json @@ -4,12 +4,13 @@ "private": true, "scripts": { "serve": "vue-cli-service serve", - "build": "vue-cli-service build", + "build": "vue-cli-service build --watch", "lint": "vue-cli-service lint", "prepare1": "vue-cli-service build --target lib --name content src/content.ts" }, "dependencies": { "@types/fs-extra": "^9.0.9", + "@types/node": "^14.14.37", "babel-eslint": "^10.1.0", "core-js": "^3.6.5", "element-ui": "^2.15.1", diff --git a/source/src/devtools/index.js b/source/src/devtools/main.ts similarity index 76% rename from source/src/devtools/index.js rename to source/src/devtools/main.ts index 037abfe..57c562e 100644 --- a/source/src/devtools/index.js +++ b/source/src/devtools/main.ts @@ -1,27 +1,25 @@ -const PluginMsg = require("../core/plugin-msg"); +import * as PluginMsg from '../core/plugin-msg' // 对应的是Elements面板的边栏 chrome.devtools.panels.elements.createSidebarPane('Cocos', function (sidebar) { sidebar.setObject({some_data: "some data to show!"}); }); // 创建devtools-panel -chrome.devtools.panels.create("Cocos", "icon/icon48.png", "pages/devtools_panel.html", function (panel) { +chrome.devtools.panels.create("Cocos", "icon/icon48.png", "pages/devtools_panel.html", function (panel: chrome.devtools.panels.ExtensionPanel) { console.log("[CC-Inspector] Dev Panel Created!"); let conn = chrome.runtime.connect({name: PluginMsg.Page.DevToolsPanel}); conn.onMessage.addListener(function (event, sender) { // debugger }); - panel.onShown.addListener(function (window) { + panel.onShown.addListener((window) => { console.log("panel show"); - // debugger conn.postMessage({msg: PluginMsg.Msg.UrlChange, data: {}}) }); - panel.onHidden.addListener(function (window) { + panel.onHidden.addListener(() => { console.log("panel hide"); }); panel.onSearch.addListener(function (action, query) { console.log("panel search!"); - return false; }); } ); diff --git a/source/src/devtools/panel/ccType/NodeBaseProperty.vue b/source/src/devtools/panel/ccType/NodeBaseProperty.vue index 9e8e658..588d0a2 100644 --- a/source/src/devtools/panel/ccType/NodeBaseProperty.vue +++ b/source/src/devtools/panel/ccType/NodeBaseProperty.vue @@ -145,9 +145,10 @@