保证基础的运行工作

This commit is contained in:
xuyanfeng 2021-04-03 11:42:08 +08:00
parent 6a7bf052c4
commit fb7ccb7038
12 changed files with 60 additions and 44 deletions

View File

@ -21,6 +21,13 @@ module.exports = {
rules: { rules: {
"@typescript-eslint/explicit-module-boundary-types": "off", "@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",
} }
}; };

View File

@ -4317,7 +4317,7 @@
}, },
"cosmiconfig": { "cosmiconfig": {
"version": "6.0.0", "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=", "integrity": "sha1-2k/uhTxS9rHmk19BwaL8UL1KmYI=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -4331,7 +4331,7 @@
"dependencies": { "dependencies": {
"path-type": { "path-type": {
"version": "4.0.0", "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=", "integrity": "sha1-hO0BwKe6OAr+CdkKjBgNzZ0DBDs=",
"dev": true, "dev": true,
"optional": true "optional": true
@ -4741,7 +4741,7 @@
}, },
"deepmerge": { "deepmerge": {
"version": "4.2.2", "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=", "integrity": "sha1-RNLqNnm49NT/ujPwPYZfwee/SVU=",
"dev": true, "dev": true,
"optional": true "optional": true
@ -6231,7 +6231,7 @@
}, },
"chalk": { "chalk": {
"version": "4.1.0", "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=", "integrity": "sha1-ThSHCmGNni7dl92DRf2dncMVZGo=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -6242,7 +6242,7 @@
}, },
"color-convert": { "color-convert": {
"version": "2.0.1", "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=", "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -6266,7 +6266,7 @@
}, },
"lru-cache": { "lru-cache": {
"version": "6.0.0", "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=", "integrity": "sha1-bW/mVw69lqr5D8rR2vo7JWbbOpQ=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -6276,7 +6276,7 @@
}, },
"schema-utils": { "schema-utils": {
"version": "2.7.0", "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=", "integrity": "sha1-FxUfdtjq5n+793lgwzxnatn078c=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -6379,7 +6379,7 @@
}, },
"fs-monkey": { "fs-monkey": {
"version": "1.0.1", "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=", "integrity": "sha1-SoLzaUQ2XmGfRFTZ//EGVTBnt4E=",
"dev": true, "dev": true,
"optional": true "optional": true
@ -12882,7 +12882,7 @@
}, },
"chalk": { "chalk": {
"version": "4.1.0", "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=", "integrity": "sha1-ThSHCmGNni7dl92DRf2dncMVZGo=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -12893,7 +12893,7 @@
}, },
"color-convert": { "color-convert": {
"version": "2.0.1", "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=", "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -12917,7 +12917,7 @@
}, },
"loader-utils": { "loader-utils": {
"version": "2.0.0", "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=", "integrity": "sha1-5MrOW4FtQloWa18JfhDNErNgZLA=",
"dev": true, "dev": true,
"optional": true, "optional": true,
@ -13777,7 +13777,7 @@
}, },
"yaml": { "yaml": {
"version": "1.10.2", "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=", "integrity": "sha1-IwHF/78StGfejaIzOkWeKeeSDks=",
"dev": true, "dev": true,
"optional": true "optional": true

View File

@ -4,12 +4,13 @@
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build --watch",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
"prepare1": "vue-cli-service build --target lib --name content src/content.ts" "prepare1": "vue-cli-service build --target lib --name content src/content.ts"
}, },
"dependencies": { "dependencies": {
"@types/fs-extra": "^9.0.9", "@types/fs-extra": "^9.0.9",
"@types/node": "^14.14.37",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"element-ui": "^2.15.1", "element-ui": "^2.15.1",

View File

@ -1,27 +1,25 @@
const PluginMsg = require("../core/plugin-msg"); import * as PluginMsg from '../core/plugin-msg'
// 对应的是Elements面板的边栏 // 对应的是Elements面板的边栏
chrome.devtools.panels.elements.createSidebarPane('Cocos', function (sidebar) { chrome.devtools.panels.elements.createSidebarPane('Cocos', function (sidebar) {
sidebar.setObject({some_data: "some data to show!"}); sidebar.setObject({some_data: "some data to show!"});
}); });
// 创建devtools-panel // 创建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!"); console.log("[CC-Inspector] Dev Panel Created!");
let conn = chrome.runtime.connect({name: PluginMsg.Page.DevToolsPanel}); let conn = chrome.runtime.connect({name: PluginMsg.Page.DevToolsPanel});
conn.onMessage.addListener(function (event, sender) { conn.onMessage.addListener(function (event, sender) {
// debugger // debugger
}); });
panel.onShown.addListener(function (window) { panel.onShown.addListener((window) => {
console.log("panel show"); console.log("panel show");
// debugger
conn.postMessage({msg: PluginMsg.Msg.UrlChange, data: {}}) conn.postMessage({msg: PluginMsg.Msg.UrlChange, data: {}})
}); });
panel.onHidden.addListener(function (window) { panel.onHidden.addListener(() => {
console.log("panel hide"); console.log("panel hide");
}); });
panel.onSearch.addListener(function (action, query) { panel.onSearch.addListener(function (action, query) {
console.log("panel search!"); console.log("panel search!");
return false;
}); });
} }
); );

View File

@ -145,9 +145,10 @@
<script lang="ts"> <script lang="ts">
import Vue from "vue" import Vue from "vue"
import {Component, Prop} from "vue-property-decorator" import {Component, Prop} from "vue-property-decorator"
import UiProp from './ui-prop' import UiProp from './ui-prop.vue'
@Component({ @Component({
'ui-prop':UiProp components: {UiProp},
}) })
export default class NodeBaseProperty extends Vue { export default class NodeBaseProperty extends Vue {
name: string = "app" name: string = "app"

View File

@ -24,13 +24,14 @@ import {Component, Prop} from "vue-property-decorator"
@Component({}) @Component({})
export default class UiProp extends Vue { export default class UiProp extends Vue {
@Prop() @Prop()
name = null; name: string = '';
@Prop() @Prop()
step = null; step: number = 1;
clientX: number = 0; clientX: number = 0;
changePositionMouseAction(event) { changePositionMouseAction(event: MouseEvent) {
document.addEventListener("mousemove", this._onMouseMove); document.addEventListener("mousemove", this._onMouseMove);
document.addEventListener("mouseup", this._onMouseUp); document.addEventListener("mouseup", this._onMouseUp);
document.addEventListener("onselectstart", this._onSelect); document.addEventListener("onselectstart", this._onSelect);
@ -40,9 +41,9 @@ export default class UiProp extends Vue {
return false; return false;
} }
_onMouseMove(event) { _onMouseMove(event: MouseEvent) {
let x = event.clientX; let x = event.clientX;
let calcStep = parseFloat(this.step) || 1;// 1 let calcStep = this.step;
if (x > this.clientX) { if (x > this.clientX) {
calcStep = Math.abs(calcStep); calcStep = Math.abs(calcStep);
} else { } else {
@ -52,7 +53,7 @@ export default class UiProp extends Vue {
this.clientX = x; this.clientX = x;
} }
_onMouseUp(event) { _onMouseUp(event: MouseEvent) {
document.removeEventListener("mousemove", this._onMouseMove); document.removeEventListener("mousemove", this._onMouseMove);
document.removeEventListener("mouseup", this._onMouseUp); document.removeEventListener("mouseup", this._onMouseUp);
document.removeEventListener("onselectstart", this._onSelect); document.removeEventListener("onselectstart", this._onSelect);

View File

@ -1,11 +1,13 @@
.layout { .layout {
display: flex; display: flex;
.vertical { &.vertical {
display: flex;
flex-direction: column; flex-direction: column;
} }
.horizontal { &.horizontal {
display: flex;
flex-direction: row; flex-direction: row;
} }

View File

@ -1,5 +1,5 @@
// eval 注入脚本的代码,变量尽量使用var,后来发现在import之后,let会自动变为var // eval 注入脚本的代码,变量尽量使用var,后来发现在import之后,let会自动变为var
const PluginMsg = require("../core/plugin-msg"); const PluginMsg = require("./core/plugin-msg");
let cc_inspector = { let cc_inspector = {
inspectorGameMemoryStorage: {}, inspectorGameMemoryStorage: {},

View File

@ -10,17 +10,17 @@ module.exports = {
icons: { icons: {
48: "icon/icon48.png" 48: "icon/icon48.png"
}, },
devtools_page: "pages/devtools.html", devtools_page: "devtools_panel.html",
content_scripts: [ content_scripts: [
{ {
matches: ["<all_urls>"], matches: ["<all_urls>"],
js: ["content.js"], js: ["js/content.js"],
run_at: "document_end", run_at: "document_end",
all_frames: true all_frames: true
} }
], ],
background: { background: {
scripts: ["background.js"], scripts: ["js/background.js"],
persistent: false,// 需要时开启 persistent: false,// 需要时开启
}, },
// optionsV1的写法 // optionsV1的写法

View File

@ -1,5 +1,6 @@
import Vue from "vue"; import Vue from "vue";
import App from "./index.vue"; import App from "./index.vue";
import "element-ui/lib/theme-chalk/index.css"
import ElementUI from "element-ui"; import ElementUI from "element-ui";
Vue.config.productionTip = false; Vue.config.productionTip = false;

View File

@ -1,9 +1,9 @@
<template> <template>
<div id="popup"> <div id="popup">
<div style="display: flex;flex-direction: row;align-items: center;"> <div style="display: flex;flex-direction: row;align-items: center;">
<h3 v-show="false">title</h3> <h3>{{ title }}</h3>
<div style="flex: 1"></div> <div style="flex: 1"></div>
<el-button @click="onClickOptions">设置</el-button> <el-button class="el-icon-setting" @click="onClickOptions"></el-button>
<el-button @click="onMsgToBg">To-Bg</el-button> <el-button @click="onMsgToBg">To-Bg</el-button>
<el-button @click="onSendMsg">Msg</el-button> <el-button @click="onSendMsg">Msg</el-button>
</div> </div>
@ -68,7 +68,10 @@ export default class App extends Vue {
onClickOptions() { onClickOptions() {
if (chrome && chrome.tabs) { if (chrome && chrome.tabs) {
chrome.tabs.create({url: "pages/options.html"}) const manifest = require('../manifest/index')
if (manifest.options_page) {
chrome.tabs.create({url: manifest.options_page})
}
} }
} }
@ -103,7 +106,6 @@ export default class App extends Vue {
onSendMsg() { onSendMsg() {
if (this.longConn) { if (this.longConn) {
this.longConn.postMessage({send: "hello"}); this.longConn.postMessage({send: "hello"});
//@import "../index.less";
} }
} }
@ -111,6 +113,8 @@ export default class App extends Vue {
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@import "../index.less";
#popup { #popup {
width: auto; width: auto;
} }

View File

@ -11,7 +11,7 @@ module.exports = {
title: "popup", title: "popup",
}, },
options: "src/options/index.ts", options: "src/options/index.ts",
devtools: "src/devtools/index.ts", devtools_panel: "src/devtools/panel/index.ts",
test: "src/test/index.ts", test: "src/test/index.ts",
}, },
configureWebpack: { configureWebpack: {
@ -19,6 +19,7 @@ module.exports = {
content: Path.join(__dirname, "src/content.ts"), content: Path.join(__dirname, "src/content.ts"),
background: Path.join(__dirname, "src/background.ts"), background: Path.join(__dirname, "src/background.ts"),
inject: Path.join(__dirname, "src/inject.js"), inject: Path.join(__dirname, "src/inject.js"),
devtools: Path.join(__dirname, "src/devtools/main.ts"),
}, },
output: { output: {
filename: "js/[name].js?t=[hash]" filename: "js/[name].js?t=[hash]"