Kaynağa Gözat

upgrade packages

Gerald 9 yıl önce
ebeveyn
işleme
cc9debcd23

+ 8 - 6
package.json

@@ -1,5 +1,5 @@
 {
 {
-  "name": "Violentmonkey",
+  "name": "violentmonkey",
   "version": "2.5.2",
   "version": "2.5.2",
   "scripts": {
   "scripts": {
     "prebuild": "gulp clean",
     "prebuild": "gulp clean",
@@ -12,8 +12,6 @@
   },
   },
   "description": "Violentmonkey",
   "description": "Violentmonkey",
   "devDependencies": {
   "devDependencies": {
-    "codemirror": "^5.14.2",
-    "define-commonjs": "^1.0.0",
     "del": "^2.2.0",
     "del": "^2.2.0",
     "glob": "^7.0.3",
     "glob": "^7.0.3",
     "gulp": "^3.9.1",
     "gulp": "^3.9.1",
@@ -29,8 +27,7 @@
     "merge2": "^1.0.2",
     "merge2": "^1.0.2",
     "mocha": "^3.1.2",
     "mocha": "^3.1.2",
     "ncp": "^2.0.0",
     "ncp": "^2.0.0",
-    "through2": "^2.0.3",
-    "vue": "^2.1.6"
+    "through2": "^2.0.3"
   },
   },
   "author": "Gerald <[email protected]>",
   "author": "Gerald <[email protected]>",
   "repository": {
   "repository": {
@@ -41,5 +38,10 @@
     "url": "https://github.com/violentmonkey/violentmonkey/issues"
     "url": "https://github.com/violentmonkey/violentmonkey/issues"
   },
   },
   "homepage": "https://github.com/violentmonkey/violentmonkey",
   "homepage": "https://github.com/violentmonkey/violentmonkey",
-  "license": "MIT"
+  "license": "MIT",
+  "dependencies": {
+    "codemirror": "^5.23.0",
+    "define-commonjs": "^1.0.0",
+    "vue": "^2.1.10"
+  }
 }
 }

+ 1 - 1
src/public/lib/CodeMirror/addon/edit/closebrackets.js

@@ -45,7 +45,7 @@
 
 
   function getConfig(cm) {
   function getConfig(cm) {
     var deflt = cm.state.closeBrackets;
     var deflt = cm.state.closeBrackets;
-    if (!deflt) return null;
+    if (!deflt || deflt.override) return deflt;
     var mode = cm.getModeAt(cm.getCursor());
     var mode = cm.getModeAt(cm.getCursor());
     return mode.closeBrackets || deflt;
     return mode.closeBrackets || deflt;
   }
   }

+ 11 - 13
src/public/lib/CodeMirror/addon/selection/active-line.js

@@ -1,12 +1,6 @@
 // CodeMirror, copyright (c) by Marijn Haverbeke and others
 // CodeMirror, copyright (c) by Marijn Haverbeke and others
 // Distributed under an MIT license: http://codemirror.net/LICENSE
 // Distributed under an MIT license: http://codemirror.net/LICENSE
 
 
-// Because sometimes you need to style the cursor's line.
-//
-// Adds an option 'styleActiveLine' which, when enabled, gives the
-// active line's wrapping <div> the CSS class "CodeMirror-activeline",
-// and gives its background <div> the class "CodeMirror-activeline-background".
-
 (function(mod) {
 (function(mod) {
   if (typeof exports == "object" && typeof module == "object") // CommonJS
   if (typeof exports == "object" && typeof module == "object") // CommonJS
     mod(require("../../lib/codemirror"));
     mod(require("../../lib/codemirror"));
@@ -21,16 +15,18 @@
   var GUTT_CLASS = "CodeMirror-activeline-gutter";
   var GUTT_CLASS = "CodeMirror-activeline-gutter";
 
 
   CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
   CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
-    var prev = old && old != CodeMirror.Init;
-    if (val && !prev) {
-      cm.state.activeLines = [];
-      updateActiveLines(cm, cm.listSelections());
-      cm.on("beforeSelectionChange", selectionChange);
-    } else if (!val && prev) {
+    var prev = old == CodeMirror.Init ? false : old;
+    if (val == prev) return
+    if (prev) {
       cm.off("beforeSelectionChange", selectionChange);
       cm.off("beforeSelectionChange", selectionChange);
       clearActiveLines(cm);
       clearActiveLines(cm);
       delete cm.state.activeLines;
       delete cm.state.activeLines;
     }
     }
+    if (val) {
+      cm.state.activeLines = [];
+      updateActiveLines(cm, cm.listSelections());
+      cm.on("beforeSelectionChange", selectionChange);
+    }
   });
   });
 
 
   function clearActiveLines(cm) {
   function clearActiveLines(cm) {
@@ -52,7 +48,9 @@
     var active = [];
     var active = [];
     for (var i = 0; i < ranges.length; i++) {
     for (var i = 0; i < ranges.length; i++) {
       var range = ranges[i];
       var range = ranges[i];
-      if (!range.empty()) continue;
+      var option = cm.getOption("styleActiveLine");
+      if (typeof option == "object" && option.nonEmpty ? range.anchor.line != range.head.line : !range.empty())
+        continue
       var line = cm.getLineHandleVisualStart(range.head.line);
       var line = cm.getLineHandleVisualStart(range.head.line);
       if (active[active.length - 1] != line) active.push(line);
       if (active[active.length - 1] != line) active.push(line);
     }
     }

+ 2 - 2
src/public/lib/CodeMirror/lib/codemirror.css

@@ -249,8 +249,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
   position: relative;
   position: relative;
   overflow: visible;
   overflow: visible;
   -webkit-tap-highlight-color: transparent;
   -webkit-tap-highlight-color: transparent;
-  -webkit-font-variant-ligatures: none;
-  font-variant-ligatures: none;
+  -webkit-font-variant-ligatures: contextual;
+  font-variant-ligatures: contextual;
 }
 }
 .CodeMirror-wrap pre {
 .CodeMirror-wrap pre {
   word-wrap: break-word;
   word-wrap: break-word;

Dosya farkı çok büyük olduğundan ihmal edildi
+ 488 - 468
src/public/lib/CodeMirror/lib/codemirror.js


+ 22 - 9
src/public/lib/CodeMirror/mode/javascript/javascript.js

@@ -12,7 +12,7 @@
 "use strict";
 "use strict";
 
 
 function expressionAllowed(stream, state, backUp) {
 function expressionAllowed(stream, state, backUp) {
-  return /^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
+  return /^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
     (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
     (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
 }
 }
 
 
@@ -146,7 +146,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
       stream.skipToEnd();
       stream.skipToEnd();
       return ret("error", "error");
       return ret("error", "error");
     } else if (isOperatorChar.test(ch)) {
     } else if (isOperatorChar.test(ch)) {
-      stream.eatWhile(isOperatorChar);
+      if (ch != ">" || !state.lexical || state.lexical.type != ">")
+        stream.eatWhile(isOperatorChar);
       return ret("operator", "operator", stream.current());
       return ret("operator", "operator", stream.current());
     } else if (wordRE.test(ch)) {
     } else if (wordRE.test(ch)) {
       stream.eatWhile(wordRE);
       stream.eatWhile(wordRE);
@@ -504,9 +505,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
     if (type == ":") return cont(expressionNoComma);
     if (type == ":") return cont(expressionNoComma);
     if (type == "(") return pass(functiondef);
     if (type == "(") return pass(functiondef);
   }
   }
-  function commasep(what, end) {
+  function commasep(what, end, sep) {
     function proceed(type, value) {
     function proceed(type, value) {
-      if (type == ",") {
+      if (sep ? sep.indexOf(type) > -1 : type == ",") {
         var lex = cx.state.lexical;
         var lex = cx.state.lexical;
         if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
         if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
         return cont(function(type, value) {
         return cont(function(type, value) {
@@ -539,16 +540,19 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
   }
   }
   function typeexpr(type) {
   function typeexpr(type) {
     if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
     if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
-    if (type == "{") return cont(commasep(typeprop, "}"))
+    if (type == "string" || type == "number" || type == "atom") return cont(afterType);
+    if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex)
     if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
     if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
   }
   }
   function maybeReturnType(type) {
   function maybeReturnType(type) {
     if (type == "=>") return cont(typeexpr)
     if (type == "=>") return cont(typeexpr)
   }
   }
-  function typeprop(type) {
+  function typeprop(type, value) {
     if (type == "variable" || cx.style == "keyword") {
     if (type == "variable" || cx.style == "keyword") {
       cx.marked = "property"
       cx.marked = "property"
       return cont(typeprop)
       return cont(typeprop)
+    } else if (value == "?") {
+      return cont(typeprop)
     } else if (type == ":") {
     } else if (type == ":") {
       return cont(typeexpr)
       return cont(typeexpr)
     }
     }
@@ -558,7 +562,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
     else if (type == ":") return cont(typeexpr)
     else if (type == ":") return cont(typeexpr)
   }
   }
   function afterType(type, value) {
   function afterType(type, value) {
-    if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
+    if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
+    if (value == "|" || type == ".") return cont(typeexpr)
     if (type == "[") return cont(expect("]"), afterType)
     if (type == "[") return cont(expect("]"), afterType)
   }
   }
   function vardef() {
   function vardef() {
@@ -655,14 +660,19 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
     if (type == ":") return cont(typeexpr, maybeAssign)
     if (type == ":") return cont(typeexpr, maybeAssign)
     return pass(functiondef)
     return pass(functiondef)
   }
   }
-  function afterExport(_type, value) {
+  function afterExport(type, value) {
     if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
     if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
     if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
     if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
+    if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
     return pass(statement);
     return pass(statement);
   }
   }
+  function exportField(type, value) {
+    if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); }
+    if (type == "variable") return pass(expressionNoComma, exportField);
+  }
   function afterImport(type) {
   function afterImport(type) {
     if (type == "string") return cont();
     if (type == "string") return cont();
-    return pass(importSpec, maybeFrom);
+    return pass(importSpec, maybeMoreImports, maybeFrom);
   }
   }
   function importSpec(type, value) {
   function importSpec(type, value) {
     if (type == "{") return contCommasep(importSpec, "}");
     if (type == "{") return contCommasep(importSpec, "}");
@@ -670,6 +680,9 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
     if (value == "*") cx.marked = "keyword";
     if (value == "*") cx.marked = "keyword";
     return cont(maybeAs);
     return cont(maybeAs);
   }
   }
+  function maybeMoreImports(type) {
+    if (type == ",") return cont(importSpec, maybeMoreImports)
+  }
   function maybeAs(_type, value) {
   function maybeAs(_type, value) {
     if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
     if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
   }
   }

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor