From 6563aca14157551b2c934b7ca56edf94cf502885 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 1 Jan 2021 18:32:04 +0300 Subject: [PATCH] CodeMirror 5.59.1 + use emptyDirSync instead of shx + restore the original jsonlint with its trailing spaces, accidentally fixed by fdbfb235 --- package-lock.json | 133 +----------------- package.json | 5 +- tools/build-vendor.js | 1 + vendor/codemirror/README.md | 2 +- vendor/codemirror/addon/edit/closebrackets.js | 22 ++- vendor/codemirror/lib/codemirror.js | 13 +- .../codemirror/mode/javascript/javascript.js | 9 +- vendor/jsonlint/jsonlint.js | 6 +- 8 files changed, 44 insertions(+), 147 deletions(-) diff --git a/package-lock.json b/package-lock.json index 842e4d61..b28d7a90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.5.14", "license": "GPL-3.0-only", "dependencies": { - "codemirror": "^5.59.0", + "codemirror": "^5.59.1", "db-to-cloud": "^0.4.5", "jsonlint": "^1.6.3", "less-bundle": "github:openstyles/less-bundle#v0.1.0", @@ -26,7 +26,6 @@ "eslint": "^7.16.0", "fs-extra": "^9.0.0", "make-fetch-happen": "^8.0.7", - "shx": "^0.3.2", "sync-version": "^1.0.1", "tiny-glob": "^0.2.6", "web-ext": "^5.4.1", @@ -1931,9 +1930,9 @@ } }, "node_modules/codemirror": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.0.tgz", - "integrity": "sha512-UGzSkCacY9z0rSpQ3wnTWRN2nvRE6foDXnJltWW8pazInR/R+3gXHrao4IFQMv/bSBvFBxt8/HPpkpKAS54x5Q==" + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.1.tgz", + "integrity": "sha512-d0SSW/PCCD4LoSCBPdnP0BzmZB1v3emomCUtVlIWgZHJ06yVeBOvBtOH7vYz707pfAvEeWbO9aP6akh8vl1V3w==" }, "node_modules/collection-visit": { "version": "1.0.0", @@ -3101,12 +3100,6 @@ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, - "node_modules/es6-object-assign": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", - "dev": true - }, "node_modules/es6-promise": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.3.0.tgz", @@ -4798,12 +4791,6 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, - "node_modules/interpret": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", - "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", - "dev": true - }, "node_modules/into-stream": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", @@ -7088,12 +7075,6 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, - "node_modules/path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -7441,15 +7422,6 @@ "node": ">=8.10.0" } }, - "node_modules/rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "dependencies": { - "resolve": "^1.1.6" - } - }, "node_modules/regenerator-runtime": { "version": "0.13.7", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", @@ -7629,15 +7601,6 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, - "node_modules/resolve": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.2.tgz", - "integrity": "sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ==", - "dev": true, - "dependencies": { - "path-parse": "^1.0.6" - } - }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -7951,28 +7914,6 @@ "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", "dev": true }, - "node_modules/shx": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.2.tgz", - "integrity": "sha512-aS0mWtW3T2sHAenrSrip2XGv39O9dXIFUqxAEWHEOS1ePtGIBavdPJY1kE2IHl14V/4iCbUiNDPGdyYTtmhSoA==", - "dev": true, - "dependencies": { - "es6-object-assign": "^1.0.3", - "minimist": "^1.2.0", - "shelljs": "^0.8.1" - } - }, - "node_modules/shx/node_modules/shelljs": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", - "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", - "dev": true, - "dependencies": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - } - }, "node_modules/sign-addon": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/sign-addon/-/sign-addon-3.1.0.tgz", @@ -11822,9 +11763,9 @@ } }, "codemirror": { - "version": "5.59.0", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.0.tgz", - "integrity": "sha512-UGzSkCacY9z0rSpQ3wnTWRN2nvRE6foDXnJltWW8pazInR/R+3gXHrao4IFQMv/bSBvFBxt8/HPpkpKAS54x5Q==" + "version": "5.59.1", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.59.1.tgz", + "integrity": "sha512-d0SSW/PCCD4LoSCBPdnP0BzmZB1v3emomCUtVlIWgZHJ06yVeBOvBtOH7vYz707pfAvEeWbO9aP6akh8vl1V3w==" }, "collection-visit": { "version": "1.0.0", @@ -12825,12 +12766,6 @@ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, - "es6-object-assign": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", - "dev": true - }, "es6-promise": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.3.0.tgz", @@ -14267,12 +14202,6 @@ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, - "interpret": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", - "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", - "dev": true - }, "into-stream": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", @@ -16167,12 +16096,6 @@ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, "path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -16458,15 +16381,6 @@ "picomatch": "^2.2.1" } }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, "regenerator-runtime": { "version": "0.13.7", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", @@ -16610,15 +16524,6 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, - "resolve": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.14.2.tgz", - "integrity": "sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ==", - "dev": true, - "requires": { - "path-parse": "^1.0.6" - } - }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -16900,30 +16805,6 @@ "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", "dev": true }, - "shx": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.2.tgz", - "integrity": "sha512-aS0mWtW3T2sHAenrSrip2XGv39O9dXIFUqxAEWHEOS1ePtGIBavdPJY1kE2IHl14V/4iCbUiNDPGdyYTtmhSoA==", - "dev": true, - "requires": { - "es6-object-assign": "^1.0.3", - "minimist": "^1.2.0", - "shelljs": "^0.8.1" - }, - "dependencies": { - "shelljs": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", - "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", - "dev": true, - "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" - } - } - } - }, "sign-addon": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/sign-addon/-/sign-addon-3.1.0.tgz", diff --git a/package.json b/package.json index 0ac30d49..73ef4567 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "repository": "openstyles/stylus", "author": "Stylus Team", "dependencies": { - "codemirror": "^5.59.0", + "codemirror": "^5.59.1", "db-to-cloud": "^0.4.5", "jsonlint": "^1.6.3", "less-bundle": "github:openstyles/less-bundle#v0.1.0", @@ -23,7 +23,6 @@ "eslint": "^7.16.0", "fs-extra": "^9.0.0", "make-fetch-happen": "^8.0.7", - "shx": "^0.3.2", "sync-version": "^1.0.1", "tiny-glob": "^0.2.6", "web-ext": "^5.4.1", @@ -34,7 +33,7 @@ "test": "npm run lint", "update-locales": "tx pull --all && webext-tx-fix", "update-transifex": "tx push -s", - "build-vendor": "shx rm -rf vendor/* && node tools/build-vendor", + "build-vendor": "node tools/build-vendor", "zip": "node tools/zip.js", "start": "web-ext run", "start-chrome": "web-ext run -t chromium", diff --git a/tools/build-vendor.js b/tools/build-vendor.js index 067c85ef..97aa69fa 100644 --- a/tools/build-vendor.js +++ b/tools/build-vendor.js @@ -68,6 +68,7 @@ const files = { main().catch(console.error); async function main() { + fse.emptyDirSync('vendor'); for (const pkg in files) { console.log('\x1b[32m%s\x1b[0m', `Building ${pkg}...`); // other files diff --git a/vendor/codemirror/README.md b/vendor/codemirror/README.md index accdd608..435d4dd2 100644 --- a/vendor/codemirror/README.md +++ b/vendor/codemirror/README.md @@ -1,4 +1,4 @@ -## codemirror v5.59.0 +## codemirror v5.59.1 Following files are copied from npm (node_modules): diff --git a/vendor/codemirror/addon/edit/closebrackets.js b/vendor/codemirror/addon/edit/closebrackets.js index 4415c393..5c1aeab3 100644 --- a/vendor/codemirror/addon/edit/closebrackets.js +++ b/vendor/codemirror/addon/edit/closebrackets.js @@ -87,7 +87,7 @@ cm.operation(function() { var linesep = cm.lineSeparator() || "\n"; cm.replaceSelection(linesep + linesep, null); - cm.execCommand("goCharLeft"); + moveSel(cm, -1) ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { var line = ranges[i].head.line; @@ -97,6 +97,17 @@ }); } + function moveSel(cm, dir) { + var newRanges = [], ranges = cm.listSelections(), primary = 0 + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i] + if (range.head == cm.getCursor()) primary = i + var pos = {line: range.head.line, ch: range.head.ch + dir} + newRanges.push({anchor: pos, head: pos}) + } + cm.setSelections(newRanges, primary) + } + function contractSelection(sel) { var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0; return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)), @@ -153,10 +164,9 @@ var right = pos % 2 ? ch : pairs.charAt(pos + 1); cm.operation(function() { if (type == "skip") { - cm.execCommand("goCharRight"); + moveSel(cm, 1) } else if (type == "skipThree") { - for (var i = 0; i < 3; i++) - cm.execCommand("goCharRight"); + moveSel(cm, 3) } else if (type == "surround") { var sels = cm.getSelections(); for (var i = 0; i < sels.length; i++) @@ -169,10 +179,10 @@ } else if (type == "both") { cm.replaceSelection(left + right, null); cm.triggerElectric(left + right); - cm.execCommand("goCharLeft"); + moveSel(cm, -1) } else if (type == "addFour") { cm.replaceSelection(left + left + left + left, "before"); - cm.execCommand("goCharRight"); + moveSel(cm, 1) } }); } diff --git a/vendor/codemirror/lib/codemirror.js b/vendor/codemirror/lib/codemirror.js index cb218678..149b6fd9 100644 --- a/vendor/codemirror/lib/codemirror.js +++ b/vendor/codemirror/lib/codemirror.js @@ -32,7 +32,7 @@ var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent); var phantom = /PhantomJS/.test(userAgent); - var ios = !edge && /AppleWebKit/.test(userAgent) && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2); + var ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2); var android = /Android/.test(userAgent); // This is woefully incomplete. Suggestions for alternative methods welcome. var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent); @@ -8676,9 +8676,12 @@ var next; if (unit == "codepoint") { var ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1)); - if (isNaN(ch)) { next = null; } - else { next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))), - -dir); } + if (isNaN(ch)) { + next = null; + } else { + var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF; + next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir); + } } else if (visually) { next = moveVisually(doc.cm, lineObj, pos, dir); } else { @@ -9790,7 +9793,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.59.0"; + CodeMirror.version = "5.59.1"; return CodeMirror; diff --git a/vendor/codemirror/mode/javascript/javascript.js b/vendor/codemirror/mode/javascript/javascript.js index 188dbf21..966ffef0 100644 --- a/vendor/codemirror/mode/javascript/javascript.js +++ b/vendor/codemirror/mode/javascript/javascript.js @@ -640,6 +640,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop) } else if (type == "(") { return pass(functiondecl, typeprop) + } else if (!type.match(/[;\}\)\],]/)) { + return cont() } } function typearg(type, value) { @@ -930,9 +932,10 @@ CodeMirror.defineMIME("text/ecmascript", "javascript"); CodeMirror.defineMIME("application/javascript", "javascript"); CodeMirror.defineMIME("application/x-javascript", "javascript"); CodeMirror.defineMIME("application/ecmascript", "javascript"); -CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); -CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true}); -CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true}); +CodeMirror.defineMIME("application/json", { name: "javascript", json: true }); +CodeMirror.defineMIME("application/x-json", { name: "javascript", json: true }); +CodeMirror.defineMIME("application/manifest+json", { name: "javascript", json: true }) +CodeMirror.defineMIME("application/ld+json", { name: "javascript", jsonld: true }); CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); diff --git a/vendor/jsonlint/jsonlint.js b/vendor/jsonlint/jsonlint.js index 9613c49c..598c18c2 100644 --- a/vendor/jsonlint/jsonlint.js +++ b/vendor/jsonlint/jsonlint.js @@ -17,7 +17,7 @@ case 1: // replace escaped characters with actual character .replace(/\\v/g,'\v') .replace(/\\f/g,'\f') .replace(/\\b/g,'\b'); - + break; case 2:this.$ = Number(yytext); break; @@ -341,7 +341,7 @@ next:function () { if (this._input === "") { return this.EOF; } else { - this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), + this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), {text: "", token: null, line: this.yylineno}); } }, @@ -429,4 +429,4 @@ exports.main = function commonjsMain(args) { if (typeof module !== 'undefined' && require.main === module) { exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); } -} +} \ No newline at end of file