From 9c3d38233c1def80dd8652eec3b85f6a8ed48d2c Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 30 May 2020 03:47:03 -0500 Subject: [PATCH 01/11] katex in deps --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fea6d52d..6d3df2ec 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,10 @@ "physical-cpu-count": "*", "semver": "^6.3.0", "ssh2": "^0.8.4", - "underscore-plus": "*" + "underscore-plus": "*", + "katex": "0.11.0", + "replace-in-file": "^3.0.0", + "fs-extra": "^5.0.0" }, "scripts": { "postinstall": "node script/postinstall.js" From 3b546d48da11f4e86edae26cbc19bf6245b7d6f2 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 30 May 2020 03:47:33 -0500 Subject: [PATCH 02/11] Katex code from ink Update postinstall.js --- lib/ui/katexify.js | 13 +++++++++++++ script/postinstall.js | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 lib/ui/katexify.js diff --git a/lib/ui/katexify.js b/lib/ui/katexify.js new file mode 100644 index 00000000..cb9f5cb7 --- /dev/null +++ b/lib/ui/katexify.js @@ -0,0 +1,13 @@ +'use babel' + +// this file is lazy loaded by dynamic import simulation + +import { renderToString } from 'katex' + +export function texify (input, block) { + try { + return renderToString(input, {throwOnError: false, displayMode: block}) + } catch (e) { + return input + } +} diff --git a/script/postinstall.js b/script/postinstall.js index 096a6705..2e0b00b4 100644 --- a/script/postinstall.js +++ b/script/postinstall.js @@ -1,8 +1,22 @@ var fs = require('fs') +var fsextra = require('fs-extra') +var replace = require('replace-in-file') function copyKeymaps () { let suffix = process.platform === 'darwin' ? '.cmd' : '.ctrl' fs.copyFileSync(__dirname + '/../keymaps/julia-client.cson' + suffix, __dirname + '/../keymaps/julia-client.cson') } +function installKaTeX () { + fsextra.copySync(__dirname + '/../node_modules/katex/dist/fonts', __dirname + '/../styles/fonts') + fsextra.copySync(__dirname + '/../node_modules/katex/dist/katex.css', __dirname + '/../styles/katex.css') + + replace.sync({ + files: __dirname + '/../styles/katex.css', + from: /url\(fonts/g, + to: 'url(atom:\/\/ink\/styles\/fonts' + }) +} + copyKeymaps() +installKaTeX() From 3fadbd347c23727bcacdf6e8b2a882f52e8ac51e Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 30 May 2020 03:47:51 -0500 Subject: [PATCH 03/11] dynamic import simulaiton --- lib/ui/views.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ui/views.coffee b/lib/ui/views.coffee index dc278d92..41213a9a 100644 --- a/lib/ui/views.coffee +++ b/lib/ui/views.coffee @@ -95,7 +95,13 @@ module.exports = views = latex: ({attrs, text}) -> block = attrs?.block || false - latex = @ink.KaTeX.texify(text, block) + + # dynamic import simulation + latex = null + texify = Promise.resolve() + .then( () -> return require("./katexify.js")) + .then( (texify) -> latex = texify(text, block)); + @render {type: 'html', block, content: latex} views: From b3ee578c71a0b602b192a01280892178f2bf4a2b Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 30 May 2020 03:47:57 -0500 Subject: [PATCH 04/11] Update package-lock.json --- package-lock.json | 378 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 378 insertions(+) diff --git a/package-lock.json b/package-lock.json index 863d9376..dc303f3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,14 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, "aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", @@ -73,6 +81,11 @@ } } }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, "bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -90,6 +103,15 @@ "safe-buffer": "^5.1.1" } }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "buffer-alloc": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", @@ -109,16 +131,94 @@ "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "chownr": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz", "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==" }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, "consistent-env": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/consistent-env/-/consistent-env-1.3.1.tgz", @@ -137,6 +237,11 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, "decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -160,6 +265,11 @@ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -168,6 +278,11 @@ "once": "^1.4.0" } }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, "etch": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/etch/-/etch-0.14.0.tgz", @@ -178,11 +293,34 @@ "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==" }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "requires": { + "locate-path": "^3.0.0" + } + }, "fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" }, + "fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, "fuzzaldrin": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fuzzaldrin/-/fuzzaldrin-2.1.0.tgz", @@ -208,16 +346,53 @@ "wide-align": "^1.1.0" } }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, "github-from-package": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=" }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -246,6 +421,31 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "katex": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.11.0.tgz", + "integrity": "sha512-RQsU3HSMjLW9AdPpi2zaBwM123goCbUcUbBJfmjcAdA982RgtEUNMmrf+3y8anGjgJLantcNLa/VSK73xztQBg==", + "requires": { + "commander": "^2.19.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, "lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -256,6 +456,14 @@ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==" }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", @@ -354,6 +562,37 @@ "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, "physical-cpu-count": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/physical-cpu-count/-/physical-cpu-count-2.0.0.tgz", @@ -421,6 +660,26 @@ "util-deprecate": "~1.0.1" } }, + "replace-in-file": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-3.4.4.tgz", + "integrity": "sha512-ehq0dFsxSpfPiPLBU5kli38Ud8bZL0CQKG8WQVbvhmyilXaMJ8y4LtDZs/K3MD8C0+rHbsfW8c9r2bUEy0B/6Q==", + "requires": { + "chalk": "^2.4.2", + "glob": "^7.1.3", + "yargs": "^13.2.2" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -566,6 +825,14 @@ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, "tar-fs": { "version": "1.16.3", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.3.tgz", @@ -633,11 +900,21 @@ "underscore": "~1.6.0" } }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + }, "which-pm-runs": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", @@ -651,6 +928,46 @@ "string-width": "^1.0.2 || 2" } }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -660,6 +977,67 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } } From 9b4fd2d32928b6f3f4e44cb6b0d27f78aa654b67 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 7 Jun 2020 21:04:33 -0500 Subject: [PATCH 05/11] using package-deps 6 --- package-lock.json | 82 +++++++---------------------------------------- package.json | 2 +- 2 files changed, 13 insertions(+), 71 deletions(-) diff --git a/package-lock.json b/package-lock.json index 863d9376..b79cd573 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,31 +32,21 @@ } }, "atom-package-deps": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/atom-package-deps/-/atom-package-deps-4.6.0.tgz", - "integrity": "sha1-u4PwqXZWO0i+TquJ58hjHD7shI0=", - "requires": { - "atom-package-path": "^1.1.0", - "sb-exec": "^3.0.1", - "sb-fs": "^3.0.0", - "semver": "^5.3.0" + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/atom-package-deps/-/atom-package-deps-6.0.0.tgz", + "integrity": "sha512-9UQx2sTvBiaIHcZ3le/B0djM+jsZXBQRPXatrmtNfjkbAOV5bGrcXzcV4U0EBfGdzB7QmWeOnwMIJwa3HvW7Kg==", + "requires": { + "sb-fs": "^4.0.0", + "semver": "^7.3.2" }, "dependencies": { "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" } } }, - "atom-package-path": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/atom-package-path/-/atom-package-path-1.1.0.tgz", - "integrity": "sha1-tR/tvADnyM5SI9DYA9t6P09pYU8=", - "requires": { - "sb-callsite": "^1.1.2" - } - }, "atom-select-list": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/atom-select-list/-/atom-select-list-0.7.2.tgz", @@ -119,14 +109,6 @@ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, - "consistent-env": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/consistent-env/-/consistent-env-1.3.1.tgz", - "integrity": "sha1-9oI018afxt2WVviuI0Kc4EmbZfs=", - "requires": { - "lodash.uniq": "^4.5.0" - } - }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", @@ -246,11 +228,6 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, - "lodash.uniq": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", - "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" - }, "mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", @@ -431,49 +408,14 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "sb-callsite": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sb-callsite/-/sb-callsite-1.1.2.tgz", - "integrity": "sha1-KBkftm1k46PukghKlakPy1ECJDs=" - }, - "sb-exec": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/sb-exec/-/sb-exec-3.1.0.tgz", - "integrity": "sha1-NMxlCIoRZ1Lrcg/d7/ZtLC6V7FE=", - "requires": { - "consistent-env": "^1.2.0", - "lodash.uniq": "^4.5.0", - "sb-npm-path": "^2.0.0" - } - }, "sb-fs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/sb-fs/-/sb-fs-3.0.0.tgz", - "integrity": "sha1-+9zdMBDoChuOJ0kM7zNgZJdCA7g=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/sb-fs/-/sb-fs-4.0.0.tgz", + "integrity": "sha512-UjjIHC4uahPWvKYqgknvFCCJ11S0oDahz+nsmyTCAmARKto31aoE+Lu7GGGK0nogengJEKGzFdh46ho5+IL88Q==", "requires": { - "sb-promisify": "^2.0.1", "strip-bom-buf": "^1.0.0" } }, - "sb-memoize": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/sb-memoize/-/sb-memoize-1.0.2.tgz", - "integrity": "sha1-EoN1xi3bnMT/qQXQxaWXwZuurY4=" - }, - "sb-npm-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/sb-npm-path/-/sb-npm-path-2.0.0.tgz", - "integrity": "sha1-D2zCzzcd68p9k27Xa31MPMHrPVg=", - "requires": { - "sb-memoize": "^1.0.2", - "sb-promisify": "^2.0.1" - } - }, - "sb-promisify": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/sb-promisify/-/sb-promisify-2.0.2.tgz", - "integrity": "sha1-QnelR1RIiqlnXYhuNU24lMm9yYE=" - }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", diff --git a/package.json b/package.json index fea6d52d..660507f2 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "atom": ">=1.39.0 <2.0.0" }, "dependencies": { - "atom-package-deps": "*", + "atom-package-deps": "^6.0.0", "atom-select-list": "^0.7.2", "etch": "^0.14", "fuzzaldrin-plus": "^0.6.0", From 920f7c633582a221c9196051332f58717c4906bf Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 8 Jun 2020 01:28:35 -0500 Subject: [PATCH 06/11] dynamic require semverSatisfies --- lib/julia-client.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/julia-client.coffee b/lib/julia-client.coffee index f8149645..fd1a7a73 100644 --- a/lib/julia-client.coffee +++ b/lib/julia-client.coffee @@ -6,7 +6,6 @@ menu = require './package/menu' settings = require './package/settings' release = require './package/release-note' toolbar = require './package/toolbar' -semver = require 'semver' # TODO: Update me when tagging a new relase (and release note) INK_VERSION_COMPAT = "^0.12.4" @@ -80,7 +79,8 @@ module.exports = JuliaClient = dismissable: true inkVersion = atom.packages.loadedPackages["ink"].metadata.version - if not atom.devMode and not semver.satisfies(inkVersion, INK_VERSION_COMPAT) + semverSatisfies = require('semver/functions/satisfies'); + if not atom.devMode and not semverSatisfies(inkVersion, INK_VERSION_COMPAT) atom.notifications.addWarning "Potentially incompatible `ink` version detected.", description: """ From a4ff37001de8b03b6035090b885e0a0fa47d69ce Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 8 Jun 2020 01:33:47 -0500 Subject: [PATCH 07/11] semver 7.3.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fea6d52d..ba849794 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "node-pty-prebuilt-multiarch": "0.9.0", "object-hash": "^2.0.3", "physical-cpu-count": "*", - "semver": "^6.3.0", + "semver": "^7.3.2", "ssh2": "^0.8.4", "underscore-plus": "*" }, From eff0f1b6d119d9cd840507b75c52c9992d1dad76 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 8 Jun 2020 01:34:13 -0500 Subject: [PATCH 08/11] Update package-lock.json --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 863d9376..f0c73b21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -475,9 +475,9 @@ "integrity": "sha1-QnelR1RIiqlnXYhuNU24lMm9yYE=" }, "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" }, "set-blocking": { "version": "2.0.0", From b137a14618d16434323419b27f0f74cc377ccfd0 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 8 Jun 2020 02:04:50 -0500 Subject: [PATCH 09/11] decaffeinate lib/julia-client --- lib/julia-client.coffee | 150 ------------------------------- lib/julia-client.js | 191 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+), 150 deletions(-) delete mode 100644 lib/julia-client.coffee create mode 100644 lib/julia-client.js diff --git a/lib/julia-client.coffee b/lib/julia-client.coffee deleted file mode 100644 index fd1a7a73..00000000 --- a/lib/julia-client.coffee +++ /dev/null @@ -1,150 +0,0 @@ -etch = require 'etch' - -commands = require './package/commands' -config = require './package/config' -menu = require './package/menu' -settings = require './package/settings' -release = require './package/release-note' -toolbar = require './package/toolbar' - -# TODO: Update me when tagging a new relase (and release note) -INK_VERSION_COMPAT = "^0.12.4" -LATEST_RELEASE_NOTE_VERSION = "0.12.5" - -INK_LINK = '[`ink`](https://github.com/JunoLab/atom-ink)' -LANGUAGE_JULIA_LINK = '[`language-julia`](https://github.com/JuliaEditorSupport/atom-language-julia)' - -module.exports = JuliaClient = - misc: require './misc' - ui: require './ui' - connection: require './connection' - runtime: require './runtime' - - activate: (state) -> - etch.setScheduler(atom.views) - process.env['TERM'] = 'xterm-256color' - commands.activate @ - x.activate() for x in [menu, @connection, @runtime] - @ui.activate @connection.client - - @requireDeps => - settings.updateSettings() - - if atom.config.get('julia-client.firstBoot') - @ui.layout.queryDefaultLayout() - else - if atom.config.get('julia-client.uiOptions.layouts.openDefaultPanesOnStartUp') - setTimeout (=> @ui.layout.restoreDefaultLayout()), 150 - - requireDeps: (fn) -> - isLoaded = atom.packages.isPackageLoaded("ink") and atom.packages.isPackageLoaded("language-julia") - - if isLoaded - fn() - else - require('atom-package-deps').install('julia-client') - .then => @enableDeps fn - .catch (err) -> - console.error err - atom.notifications.addError 'Installing Juno\'s dependencies failed.', - description: - """ - Juno requires the packages #{INK_LINK} and #{LANGUAGE_JULIA_LINK} to run. - Please install them manually via `File -> Settings -> Packages`, - or open a terminal and run - - apm install ink - apm install language-julia - - and then restart Atom. - """ - dismissable: true - - enableDeps: (fn) -> - isEnabled = atom.packages.isPackageLoaded("ink") and atom.packages.isPackageLoaded("language-julia") - - if isEnabled - fn() - else - atom.packages.enablePackage('ink') - atom.packages.enablePackage('language-julia') - - if atom.packages.isPackageLoaded("ink") and atom.packages.isPackageLoaded("language-julia") - atom.notifications.addSuccess "Automatically enabled Juno's dependencies.", - description: - """ - Juno requires the #{INK_LINK} and #{LANGUAGE_JULIA_LINK} packages. - We've automatically enabled them for you. - """ - dismissable: true - - inkVersion = atom.packages.loadedPackages["ink"].metadata.version - semverSatisfies = require('semver/functions/satisfies'); - if not atom.devMode and not semverSatisfies(inkVersion, INK_VERSION_COMPAT) - atom.notifications.addWarning "Potentially incompatible `ink` version detected.", - description: - """ - Please make sure to upgrade #{INK_LINK} to a version compatible with `#{INK_VERSION_COMPAT}`. - The currently installed version is `#{inkVersion}`. - - If you cannot install an appropriate version via via `File -> Settings -> Packages`, - open a terminal and run - - apm install ink@x.y.z - - where `x.y.z` is satisfies `#{INK_VERSION_COMPAT}`. - """ - dismissable: true - - fn() - else - atom.notifications.addError "Failed to enable Juno's dependencies.", - description: - """ - Juno requires the #{INK_LINK} and #{LANGUAGE_JULIA_LINK} packages. - Please install them manually via `File -> Settings -> Packages`, - or open a terminal and run - - apm install ink - apm install language-julia - - and then restart Atom. - """ - dismissable: true - - config: config - - deactivate: -> - x.deactivate() for x in [commands, menu, toolbar, release, @connection, @runtime, @ui] - - consumeInk: (ink) -> - commands.ink = ink - x.consumeInk ink for x in [@connection, @runtime, @ui] - try - v = atom.config.get('julia-client.currentVersion') - if v isnt LATEST_RELEASE_NOTE_VERSION - release.activate(ink, LATEST_RELEASE_NOTE_VERSION) - else - release.activate(ink) - catch err - console.log(err) - finally - atom.config.set('julia-client.currentVersion', LATEST_RELEASE_NOTE_VERSION) - - consumeStatusBar: (bar) -> @runtime.consumeStatusBar bar - - consumeToolBar: (bar) -> toolbar.consumeToolBar bar - - consumeGetServerConfig: (conf) -> @connection.consumeGetServerConfig(conf) - - consumeGetServerName: (name) -> @connection.consumeGetServerName(name) - - consumeDatatip: (datatipService) -> @runtime.consumeDatatip datatipService - - provideClient: -> @connection.client - - provideAutoComplete: -> @runtime.provideAutoComplete() - - provideHyperclick: -> @runtime.provideHyperclick() - - handleURI: (parsedURI) -> @runtime.handleURI parsedURI diff --git a/lib/julia-client.js b/lib/julia-client.js new file mode 100644 index 00000000..fe5a265e --- /dev/null +++ b/lib/julia-client.js @@ -0,0 +1,191 @@ +'use babel' + +import etch from 'etch'; +import commands from './package/commands'; +import config from './package/config'; +import menu from './package/menu'; +import * as settings from './package/settings'; +import * as release from './package/release-note'; +import toolbar from './package/toolbar'; + +// TODO: Update me when tagging a new relase (and release note) +const INK_VERSION_COMPAT = "^0.12.4"; +const LATEST_RELEASE_NOTE_VERSION = "0.12.5"; + +const INK_LINK = '[`ink`](https://github.com/JunoLab/atom-ink)'; +const LANGUAGE_JULIA_LINK = '[`language-julia`](https://github.com/JuliaEditorSupport/atom-language-julia)'; + +const JuliaClient = { + misc: require('./misc'), + ui: require('./ui'), + connection: require('./connection'), + runtime: require('./runtime'), + + activate(state) { + etch.setScheduler(atom.views); + process.env['TERM'] = 'xterm-256color'; + commands.activate(this); + for (let x of [menu, this.connection, this.runtime]) { + x.activate(); + } + this.ui.activate(this.connection.client); + + this.requireDeps(() => { + settings.updateSettings(); + + if (atom.config.get('julia-client.firstBoot')) { + this.ui.layout.queryDefaultLayout(); + } else { + if (atom.config.get('julia-client.uiOptions.layouts.openDefaultPanesOnStartUp')) { + setTimeout((() => this.ui.layout.restoreDefaultLayout()), 150); + } + } + }); + }, + + requireDeps(fn) { + const isLoaded = atom.packages.isPackageLoaded("ink") && atom.packages.isPackageLoaded("language-julia"); + + if (isLoaded) { + fn(); + } else { + require('atom-package-deps').install('julia-client') + .then(() => this.enableDeps(fn)) + .catch(function (err) { + console.error(err); + atom.notifications.addError('Installing Juno\'s dependencies failed.', { + description: + `Juno requires the packages ${INK_LINK} and ${LANGUAGE_JULIA_LINK} to run. + Please install them manually via \`File -> Settings -> Packages\`, + or open a terminal and run + + apm install ink + apm install language-julia + + and then restart Atom.`, + dismissable: true + } + ); + }); + } + }, + + enableDeps(fn) { + const isEnabled = atom.packages.isPackageLoaded("ink") && atom.packages.isPackageLoaded("language-julia"); + + if (isEnabled) { + fn(); + } else { + atom.packages.enablePackage('ink'); + atom.packages.enablePackage('language-julia'); + + if (atom.packages.isPackageLoaded("ink") && atom.packages.isPackageLoaded("language-julia")) { + atom.notifications.addSuccess("Automatically enabled Juno's dependencies.", { + description: + `Juno requires the ${INK_LINK} and ${LANGUAGE_JULIA_LINK} packages. + We've automatically enabled them for you.`, + dismissable: true + } + ); + + const inkVersion = atom.packages.loadedPackages["ink"].metadata.version; + const semverSatisfies = require('semver/functions/satisfies'); + if (!atom.devMode && !semverSatisfies(inkVersion, INK_VERSION_COMPAT)) { + atom.notifications.addWarning("Potentially incompatible `ink` version detected.", { + description: + `Please make sure to upgrade ${INK_LINK} to a version compatible with \`${INK_VERSION_COMPAT}\`. + The currently installed version is \`${inkVersion}\`. + + If you cannot install an appropriate version via via \`File -> Settings -> Packages\`, + open a terminal and run + + apm install ink@x.y.z + + where \`x.y.z\` is satisfies \`${INK_VERSION_COMPAT}\`.`, + dismissable: true + } + ); + } + + fn(); + } else { + atom.notifications.addError("Failed to enable Juno's dependencies.", { + description: + `Juno requires the ${INK_LINK} and ${LANGUAGE_JULIA_LINK} packages. + Please install them manually via \`File -> Settings -> Packages\`, + or open a terminal and run + + apm install ink + apm install language-julia + + and then restart Atom.`, + dismissable: true + } + ); + } + } + }, + + config, + + deactivate() { + [commands, menu, toolbar, release, this.connection, this.runtime, this.ui].map((x) => x.deactivate()); + }, + + consumeInk(ink) { + commands.ink = ink; + for (let x of [this.connection, this.runtime, this.ui]) { + x.consumeInk(ink); + } + try { + const v = atom.config.get('julia-client.currentVersion'); + if (v !== LATEST_RELEASE_NOTE_VERSION) { + release.activate(ink, LATEST_RELEASE_NOTE_VERSION); + } else { + release.activate(ink); + } + } catch (err) { + console.log(err); + } finally { + atom.config.set('julia-client.currentVersion', LATEST_RELEASE_NOTE_VERSION); + } + }, + + consumeStatusBar(bar) { + this.runtime.consumeStatusBar(bar); + }, + + consumeToolBar(bar) { + toolbar.consumeToolBar(bar); + }, + + consumeGetServerConfig(conf) { + this.connection.consumeGetServerConfig(conf); + }, + + consumeGetServerName(name) { + this.connection.consumeGetServerName(name); + }, + + consumeDatatip(datatipService) { + this.runtime.consumeDatatip(datatipService); + }, + + provideClient() { + return this.connection.client; + }, + + provideAutoComplete() { + return this.runtime.provideAutoComplete(); + }, + + provideHyperclick() { + return this.runtime.provideHyperclick(); + }, + + handleURI(parsedURI) { + this.runtime.handleURI(parsedURI); + } +}; + +export default JuliaClient; From bcbffc14b6ceeb1b7d715b28717fe336ef409a24 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 8 Jun 2020 03:04:11 -0500 Subject: [PATCH 10/11] [skip-ci] add TODO --- lib/julia-client.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/julia-client.js b/lib/julia-client.js index fe5a265e..5373f740 100644 --- a/lib/julia-client.js +++ b/lib/julia-client.js @@ -15,7 +15,9 @@ const LATEST_RELEASE_NOTE_VERSION = "0.12.5"; const INK_LINK = '[`ink`](https://github.com/JunoLab/atom-ink)'; const LANGUAGE_JULIA_LINK = '[`language-julia`](https://github.com/JuliaEditorSupport/atom-language-julia)'; + const JuliaClient = { + // TODO Fix all of these dynamic requires and circular dependencies misc: require('./misc'), ui: require('./ui'), connection: require('./connection'), From bb62fae785b406a98ae0a389cb7fa0ae0caebed3 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 8 Jun 2020 04:17:08 -0500 Subject: [PATCH 11/11] Fix dynamic requires --- lib/julia-client.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/julia-client.js b/lib/julia-client.js index 5373f740..91bbb84b 100644 --- a/lib/julia-client.js +++ b/lib/julia-client.js @@ -15,13 +15,18 @@ const LATEST_RELEASE_NOTE_VERSION = "0.12.5"; const INK_LINK = '[`ink`](https://github.com/JunoLab/atom-ink)'; const LANGUAGE_JULIA_LINK = '[`language-julia`](https://github.com/JuliaEditorSupport/atom-language-julia)'; +import misc from './misc' +import ui from './ui' +import connection from './connection' +import runtime from './runtime' const JuliaClient = { - // TODO Fix all of these dynamic requires and circular dependencies - misc: require('./misc'), - ui: require('./ui'), - connection: require('./connection'), - runtime: require('./runtime'), + // TODO remove these from the export default and export them directly (prevents expensive copy) + // TODO don't use this.message use message directly (prevents expensive copy) + misc: misc, + ui: ui, + connection: connection, + runtime: runtime, activate(state) { etch.setScheduler(atom.views);