diff --git a/Android/doric/src/main/java/com/github/penfeizhou/doric/DoricContext.java b/Android/doric/src/main/java/com/github/penfeizhou/doric/DoricContext.java index 5dd4046e..471fe994 100644 --- a/Android/doric/src/main/java/com/github/penfeizhou/doric/DoricContext.java +++ b/Android/doric/src/main/java/com/github/penfeizhou/doric/DoricContext.java @@ -23,6 +23,7 @@ public class DoricContext { private final Context mContext; private RootNode mRootNode = new RootNode(this); private final String source; + private String script; DoricContext(Context context, String contextId, String source) { this.mContext = context; @@ -34,8 +35,13 @@ public class DoricContext { return source; } + public String getScript() { + return script; + } + public static DoricContext create(Context context, String script, String source) { DoricContext doricContext = DoricContextManager.getInstance().createContext(context, script, source); + doricContext.script = script; doricContext.callEntity(DoricConstant.DORIC_ENTITY_CREATE); return doricContext; } diff --git a/Android/doric/src/main/java/com/github/penfeizhou/doric/dev/LocalServer.java b/Android/doric/src/main/java/com/github/penfeizhou/doric/dev/LocalServer.java index 58b4f9c2..7735227f 100644 --- a/Android/doric/src/main/java/com/github/penfeizhou/doric/dev/LocalServer.java +++ b/Android/doric/src/main/java/com/github/penfeizhou/doric/dev/LocalServer.java @@ -58,6 +58,26 @@ public class LocalServer extends NanoHTTPD { return jsonArray; } }); + commandMap.put("context", new APICommand() { + @Override + public String name() { + return "context"; + } + + @Override + public Object exec(IHTTPSession session) { + String id = session.getParms().get("id"); + DoricContext doricContext = DoricContextManager.getContext(id); + if (doricContext != null) { + return new JSONBuilder() + .put("id", doricContext.getContextId()) + .put("source", doricContext.getSource()) + .put("script", doricContext.getScript()) + .toJSONObject(); + } + return "{}"; + } + }); } private static String getIpAddressString() { diff --git a/debugger/package-lock.json b/debugger/package-lock.json index a85738aa..b7536145 100644 --- a/debugger/package-lock.json +++ b/debugger/package-lock.json @@ -2179,6 +2179,11 @@ "resolve": "^1.4.0" } }, + "babel-plugin-prismjs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-prismjs/-/babel-plugin-prismjs-1.1.1.tgz", + "integrity": "sha512-MmwxA//jBpXH0IhJ2FbpBJmd6Bvq5rBe3UD3udUqfkkOdh6lmQeYxoVGpkIvLuuXecrynWjpPqwM0JPxErebpQ==" + }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -2858,6 +2863,17 @@ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "dev": true }, + "clipboard": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.4.tgz", + "integrity": "sha512-Vw26VSLRpJfBofiVaFb/I8PVfdI1OxKcYShe6fm0sP/DtmiWQNCjhM/okTvdCo0G+lMMm1rMYbk4IK4x1X+kgQ==", + "optional": true, + "requires": { + "good-listener": "^1.2.2", + "select": "^1.1.2", + "tiny-emitter": "^2.0.0" + } + }, "clipboardy": { "version": "2.1.0", "resolved": "https://registry.npm.taobao.org/clipboardy/download/clipboardy-2.1.0.tgz", @@ -3824,6 +3840,12 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, + "delegate": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz", + "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==", + "optional": true + }, "depd": { "version": "1.1.2", "resolved": "https://registry.npm.taobao.org/depd/download/depd-1.1.2.tgz", @@ -5820,6 +5842,15 @@ } } }, + "good-listener": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz", + "integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=", + "optional": true, + "requires": { + "delegate": "^3.1.2" + } + }, "graceful-fs": { "version": "4.2.1", "resolved": "https://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.2.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgraceful-fs%2Fdownload%2Fgraceful-fs-4.2.1.tgz", @@ -8796,6 +8827,14 @@ "utila": "~0.4" } }, + "prismjs": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.17.1.tgz", + "integrity": "sha512-PrEDJAFdUGbOP6xK/UsfkC5ghJsPJviKgnQOoxaDbBjwc8op68Quupwt1DeAFoG8GImPhiKXAvvsH7wDSLsu1Q==", + "requires": { + "clipboard": "^2.0.0" + } + }, "private": { "version": "0.1.8", "resolved": "https://registry.npm.taobao.org/private/download/private-0.1.8.tgz", @@ -9464,6 +9503,12 @@ "ajv-keywords": "^3.1.0" } }, + "select": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", + "integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=", + "optional": true + }, "select-hose": { "version": "2.0.0", "resolved": "https://registry.npm.taobao.org/select-hose/download/select-hose-2.0.0.tgz", @@ -10489,6 +10534,12 @@ "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", "dev": true }, + "tiny-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", + "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", + "optional": true + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npm.taobao.org/tmp/download/tmp-0.0.33.tgz", @@ -11088,6 +11139,14 @@ } } }, + "vue-prism": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/vue-prism/-/vue-prism-1.0.5.tgz", + "integrity": "sha1-bnd3rbL6EcCoy5ngJlESoQVUlVA=", + "requires": { + "prismjs": "^1.6.0" + } + }, "vue-router": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.2.tgz", diff --git a/debugger/package.json b/debugger/package.json index d3a6e809..f99a5372 100644 --- a/debugger/package.json +++ b/debugger/package.json @@ -9,9 +9,12 @@ }, "dependencies": { "axios": "^0.19.0", + "babel-plugin-prismjs": "^1.1.1", "core-js": "^2.6.5", "element-ui": "^2.11.1", + "prismjs": "^1.17.1", "vue": "^2.6.10", + "vue-prism": "^1.0.5", "vue-router": "^3.1.2" }, "devDependencies": { diff --git a/debugger/public/index.html b/debugger/public/index.html index ad9563f5..c80f7851 100644 --- a/debugger/public/index.html +++ b/debugger/public/index.html @@ -7,6 +7,7 @@