diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..56f3467 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +node_modules +web-ext-artifacts +vendor \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..5c951c8 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,20 @@ +{ + "env": { + "browser": true, + "es6": true, + "commonjs": true + }, + "extends": [ + "standard" + ], + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaVersion": 2018 + }, + "rules": { + "no-undef": 2 + } +} \ No newline at end of file diff --git a/background/js/index.js b/background/js/index.js index 7316268..e6532d0 100644 --- a/background/js/index.js +++ b/background/js/index.js @@ -1,59 +1,63 @@ console.log('SOMtodayn\'t background script loaded') // Read array from local storage -function getSlogans() { - var slogans; - if (localStorage.getItem('SOMtodayntSlogans') != null) { - slogans = JSON.parse(localStorage.getItem('SOMtodayntSlogans')); - tonight = JSON.parse(localStorage.getItem('SOMtonight')); - } else { - var slogans = [ "Welkom bij SOMtodayn't" ]; - var tonight = true; - localStorage.setItem('SOMtodayntSlogans', JSON.stringify(slogans)); - localStorage.setItem('SOMtonight', JSON.stringify(tonight)); - } - return [ - tonight, - slogans - ]; +function getSlogans () { + let slogans + let tonight + + if (localStorage.getItem('SOMtodayntSlogans') != null) { + slogans = JSON.parse(localStorage.getItem('SOMtodayntSlogans')) + tonight = JSON.parse(localStorage.getItem('SOMtonight')) + } else { + slogans = ["Welkom bij SOMtodayn't"] + tonight = true + localStorage.setItem('SOMtodayntSlogans', JSON.stringify(slogans)) + localStorage.setItem('SOMtonight', JSON.stringify(tonight)) + } + + return [ + tonight, + slogans + ] } // Update array in local storage -function setSlogans(array) { - localStorage.setItem('SOMtodayntSlogans', JSON.stringify(array)); - return true; +function setSlogans (array) { + localStorage.setItem('SOMtodayntSlogans', JSON.stringify(array)) + return true } -function setTonight(value) { - localStorage.setItem('SOMtonight', JSON.stringify(value)); - return; +function setTonight (value) { + localStorage.setItem('SOMtonight', JSON.stringify(value)) } // Handle requests -function handleMessage(request, sender, sendResponse) { - var response; - // DEBUG // console.log(sender); - // DEBUG // console.log("Request: " + request.type) - switch (request.type) { - case 'get': - response = getSlogans(); - break; +function handleMessage (request, sender, sendResponse) { + let response + // DEBUG // console.log(sender); + // DEBUG // console.log("Request: " + request.type) + switch (request.type) { + case 'get': + response = getSlogans() + break - case 'setSlogans': - response = setSlogans(request.value); - break; + case 'setSlogans': + response = setSlogans(request.value) + break - case 'setTonight': - response = setTonight(request.value); - break; - } - // Send response to either the content script or popup - if (sender.tab) { - browser.tabs.sendMessage(sender.tab.id, response); - } else { - sendResponse({response: response}); - } - // DEBUG // console.log("Response: " + response) + case 'setTonight': + response = setTonight(request.value) + break + } + // Send response to either the content script or popup + if (sender.tab) { + browser.tabs.sendMessage(sender.tab.id, response) + } else { + sendResponse({ + response: response + }) + } + // DEBUG // console.log("Response: " + response) } - -browser.runtime.onMessage.addListener(handleMessage); \ No newline at end of file + +browser.runtime.onMessage.addListener(handleMessage) diff --git a/content/js/index.js b/content/js/index.js index 69c942e..af58f52 100644 --- a/content/js/index.js +++ b/content/js/index.js @@ -1,62 +1,63 @@ -console.log('Somtoday\'nt content script active'); +console.log('Somtoday\'nt content script active') -function changeSlogan(message) -{ - if (message == 'reload') { - location.reload(); - } else { - tonight = message[0]; - slogans = message[1]; +function changeSlogan (message) { + if (message === 'reload') { + location.reload() + } else { + const tonight = message[0] + const slogans = message[1] - // Set theme - console.log(tonight); - if (tonight) { - var cssUrl = browser.runtime.getURL("content/css/index.css"); - var cssTag = ``; - document.head.innerHTML += cssTag; - } - - // Select random slogan - console.log(`Loaded ${slogans.length} slogans`); - if (slogans.length >= 1) { - var random = Math.floor(Math.random() * slogans.length); - var sloganText = slogans[random].toLowerCase(); - console.log(`Slogan changed to: ${sloganText}`); - } else { - var sloganText = "welkom bij somtodayn't"; - console.log('No slogans found') - } - - // Split the slogan into array - var sloganArray = sloganText.split(" "); - var slogan = { - white: '', - blue: '' - }; - - // Set the last word in the array to be blue - if (sloganArray.length > 1) { - slogan.blue = sloganArray.pop(); - for (let index = 0; index < sloganArray.length; index++) { - slogan.white = slogan.white + sloganArray[index] + " "; - } - } else { - slogan.white = sloganArray; - } - - // Edit HTML - document.getElementById('slogan').innerHTML = - `${slogan.white} - ${slogan.blue}` - ; - - // Add a little credit - document.querySelectorAll('footer > span')[0].innerHTML = "Somtodayn't is een add-on door McArn."; + // Set theme + console.log(tonight) + if (tonight) { + const cssUrl = browser.runtime.getURL('content/css/index.css') + const cssTag = `` + document.head.innerHTML += cssTag } + + // Select random slogan + console.log(`Loaded ${slogans.length} slogans`) + let sloganText + + if (slogans.length >= 1) { + const random = Math.floor(Math.random() * slogans.length) + sloganText = slogans[random].toLowerCase() + console.log(`Slogan changed to: ${sloganText}`) + } else { + sloganText = "welkom bij somtodayn't" + console.log('No slogans found') + } + + // Split the slogan into array + const sloganArray = sloganText.split(' ') + const slogan = { + white: '', + blue: '' + } + + // Set the last word in the array to be blue + if (sloganArray.length > 1) { + slogan.blue = sloganArray.pop() + for (let index = 0; index < sloganArray.length; index++) { + slogan.white = slogan.white + sloganArray[index] + ' ' + } + } else { + slogan.white = sloganArray + } + + // Edit HTML + document.getElementById('slogan').innerHTML = + `${slogan.white}${slogan.blue}` + + // Add a little credit + document.querySelectorAll('footer > span')[0].innerHTML = "Somtodayn't is een add-on door McArn." + } } // Send request to background script -browser.runtime.sendMessage({ type: "get"}); +browser.runtime.sendMessage({ + type: 'get' +}) // Receive response from background script -browser.runtime.onMessage.addListener(changeSlogan); \ No newline at end of file +browser.runtime.onMessage.addListener(changeSlogan) diff --git a/package-lock.json b/package-lock.json index 9401f6e..245824f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -188,6 +188,12 @@ "defer-to-connect": "^1.0.1" } }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -261,6 +267,107 @@ "yauzl": "2.10.0" }, "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "requires": { + "ms": "2.1.2" + } + }, + "eslint": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.14.0.tgz", + "integrity": "sha512-5YubdnPXrlrYAFCKybPuHIAH++PINe1pmKNc5wQRB9HSbqIK1ywAnntE3Wwua4giKu0bjligf1gLF6qxMGOYRA==", + "requires": { + "@babel/code-frame": "^7.0.0", + "@eslint/eslintrc": "^0.2.1", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.0", + "esquery": "^1.2.0", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash": "^4.17.19", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + } + }, + "file-entry-cache": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", + "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "requires": { + "flat-cache": "^2.0.1" + } + }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + } + }, + "flatted": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", + "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==" + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "requires": { + "glob": "^7.1.3" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "requires": { + "ansi-regex": "^5.0.0" + } + }, "yargs": { "version": "16.1.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.1.1.tgz", @@ -494,6 +601,41 @@ "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=" }, + "array-includes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.2.tgz", + "integrity": "sha512-w2GspexNQpx+PutG3QpT437/BenZBj0M/MZGn5mzv/MofYqo0xmRHzn4lFsoDlWJ+THYsGJmFlW68WlDFx7VRw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1", + "get-intrinsic": "^1.0.1", + "is-string": "^1.0.5" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + } + } + }, "array-map": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", @@ -515,6 +657,39 @@ "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "optional": true }, + "array.prototype.flat": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz", + "integrity": "sha512-4470Xi3GAPAjZqFcljX2xzckv1qeKPizoNkiS0+O4IoPR2ZNpcjE0pkhdihlDouK+x6QOast26B4Q/O9DJnwSg==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + } + } + }, "arrify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", @@ -1114,6 +1289,12 @@ "xdg-basedir": "^4.0.0" } }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true + }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -1528,12 +1709,13 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "eslint": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.14.0.tgz", - "integrity": "sha512-5YubdnPXrlrYAFCKybPuHIAH++PINe1pmKNc5wQRB9HSbqIK1ywAnntE3Wwua4giKu0bjligf1gLF6qxMGOYRA==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.15.0.tgz", + "integrity": "sha512-Vr64xFDT8w30wFll643e7cGrIkPEU50yIiI36OdSIDoSGguIeaLzBo0vpGvzo9RECUqq7htURfwEtKqwytkqzA==", + "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.2.1", + "@eslint/eslintrc": "^0.2.2", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -1543,10 +1725,10 @@ "eslint-scope": "^5.1.1", "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.0", + "espree": "^7.3.1", "esquery": "^1.2.0", "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", + "file-entry-cache": "^6.0.0", "functional-red-black-tree": "^1.0.1", "glob-parent": "^5.0.0", "globals": "^12.1.0", @@ -1574,36 +1756,162 @@ "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true }, "debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, "requires": { "ms": "2.1.2" } }, + "espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, "requires": { "ansi-regex": "^5.0.0" } } } }, + "eslint-config-standard": { + "version": "16.0.2", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-16.0.2.tgz", + "integrity": "sha512-fx3f1rJDsl9bY7qzyX8SAtP8GBSk6MfXFaTfaGgk12aAYW4gJSyRm7dM790L6cbXv63fvjY4XeSzXnb4WM+SKw==", + "dev": true + }, + "eslint-import-resolver-node": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", + "integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "resolve": "^1.13.1" + } + }, + "eslint-module-utils": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", + "integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==", + "dev": true, + "requires": { + "debug": "^2.6.9", + "pkg-dir": "^2.0.0" + } + }, + "eslint-plugin-es": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + } + }, + "eslint-plugin-import": { + "version": "2.22.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", + "integrity": "sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==", + "dev": true, + "requires": { + "array-includes": "^3.1.1", + "array.prototype.flat": "^1.2.3", + "contains-path": "^0.1.0", + "debug": "^2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "^0.3.4", + "eslint-module-utils": "^2.6.0", + "has": "^1.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.1", + "read-pkg-up": "^2.0.0", + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" + }, + "dependencies": { + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + } + } + } + }, "eslint-plugin-no-unsanitized": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-3.1.4.tgz", "integrity": "sha512-WF1+eZo2Sh+bQNjZuVNwT0dA61zuJORsLh+1Sww7+O6GOPw+WPWIIRfTWNqrmaXaDMhM4SXAqYPcNlhRMiH13g==" }, + "eslint-plugin-node": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, + "requires": { + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "dependencies": { + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "eslint-plugin-promise": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz", + "integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==", + "dev": true + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -1901,11 +2209,12 @@ } }, "file-entry-cache": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", - "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.0.tgz", + "integrity": "sha512-fqoO76jZ3ZnYrXLDRxBR1YvOvc0k844kcOg40bgsPrE25LAb/PDqTY+ho64Xh2c8ZXgIKldchCFHczG2UVRcWA==", + "dev": true, "requires": { - "flat-cache": "^2.0.1" + "flat-cache": "^3.0.4" } }, "fill-range": { @@ -1970,13 +2279,13 @@ "integrity": "sha512-LNRvR4hr/S8cXXkIY5pTgVP7L3tq6LlYWcg9nWBuW7o1NMxKZo6oOVa/6GIekMGI0Iw7uC+HWimMe9u/VAeKqw==" }, "flat-cache": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", - "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, "requires": { - "flatted": "^2.0.0", - "rimraf": "2.6.3", - "write": "1.0.3" + "flatted": "^3.1.0", + "rimraf": "^3.0.2" } }, "flatstr": { @@ -1985,9 +2294,10 @@ "integrity": "sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==" }, "flatted": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", - "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.0.tgz", + "integrity": "sha512-tW+UkmtNg/jv9CSofAKvgVcO7c2URjhTdW1ZTkcAritblu8tajiYy7YisnIflEwtKssCtOxpnBRoCB7iap0/TA==", + "dev": true }, "fluent-syntax": { "version": "0.13.0", @@ -2327,6 +2637,12 @@ "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==" }, + "hosted-git-info": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", + "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", + "dev": true + }, "htmlparser2": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", @@ -2482,6 +2798,15 @@ "ci-info": "^2.0.0" } }, + "is-core-module": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", + "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", @@ -2569,6 +2894,12 @@ "resolved": "https://registry.npmjs.org/is-mergeable-object/-/is-mergeable-object-1.1.1.tgz", "integrity": "sha512-CPduJfuGg8h8vW74WOxHtHmtQutyQBzR+3MjQ6iDHIYdbOnm1YC7jv43SqCoU8OPGTJD4nibmiryA4kmogbGrA==" }, + "is-negative-zero": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", + "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "dev": true + }, "is-npm": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", @@ -2617,6 +2948,12 @@ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true + }, "is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", @@ -2751,6 +3088,15 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -2921,6 +3267,35 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -3382,6 +3757,26 @@ } } }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -3497,6 +3892,40 @@ "isobject": "^3.0.1" } }, + "object.values": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.2.tgz", + "integrity": "sha512-MYC0jvJopr8EK6dPBiO8Nb9mvjdypOachO5REGk6MXzujbBrAisKo3HmdEI6kZDL6fC31Mwee/5YbtMebixeag==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.1", + "has": "^1.0.3" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0-next.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", + "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.2", + "is-negative-zero": "^2.0.0", + "is-regex": "^1.1.1", + "object-inspect": "^1.8.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.1", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + } + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3663,6 +4092,21 @@ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, + "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-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, "pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", @@ -3679,6 +4123,12 @@ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "optional": true }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, "pino": { "version": "6.7.0", "resolved": "https://registry.npmjs.org/pino/-/pino-6.7.0.tgz", @@ -3697,6 +4147,66 @@ "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-2.5.0.tgz", "integrity": "sha512-wXqbqSrIhE58TdrxxlfLwU9eDhrzppQDvGhBEr1gYbzzM4KKo3Y63gSjiDXRKLVS2UOXdPNR2v+KnQgNrs+xUg==" }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -3806,6 +4316,78 @@ } } }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, "readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -3988,6 +4570,16 @@ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, + "resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "requires": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -4014,9 +4606,10 @@ "optional": true }, "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, "requires": { "glob": "^7.1.3" } @@ -4368,6 +4961,38 @@ "os-shim": "^0.1.2" } }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.7.tgz", + "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", + "dev": true + }, "split": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", @@ -4732,6 +5357,26 @@ "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.4.6.tgz", "integrity": "sha1-0EsigOTHkqWBVCnve4tgxkyczDQ=" }, + "tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -4910,6 +5555,16 @@ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz", "integrity": "sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q==" }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "verror": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", diff --git a/package.json b/package.json index ff5a002..396e900 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,13 @@ "web-ext": "^5.4.1", "webextension-polyfill": "^0.7.0" }, - "devDependencies": {}, + "devDependencies": { + "eslint": "^7.15.0", + "eslint-config-standard": "^16.0.2", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^4.2.1" + }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, diff --git a/popup/js/index.js b/popup/js/index.js index f41cbbd..5cb2b79 100644 --- a/popup/js/index.js +++ b/popup/js/index.js @@ -1,106 +1,103 @@ -console.log("SOMtodayn't popup loaded."); -var request; -var response; +console.log("SOMtodayn't popup loaded.") +let request // Get slogans from background script request = browser.runtime.sendMessage({ - type: "get" -}); -request.then(function(message) { - var darkmode = message.response[0]; - var sloganArray = message.response[1]; + type: 'get' +}) +request.then(function (message) { + const darkmode = message.response[0] + const sloganArray = message.response[1] - // Add a slogan to the array - function addSlogan(value) { - sloganArray.push(value); - updateSlogans(sloganArray); - } + // Add a slogan to the array + function addSlogan (value) { + sloganArray.push(value) + updateSlogans(sloganArray) + } - // Remove a slogan from the array - function removeSlogan(id) { - var array = []; - if (sloganArray.length > 1) { - for (let index = 0; index < sloganArray.length; index++) { - const element = sloganArray[index]; - if (index != id) { - array.push(element); - } - } - updateSlogans(array); - } else { - window.alert("U kunt de laatste slogan niet verwijderen."); - } - } - - // Send updated array to background script - function updateSlogans(array) { - request = browser.runtime.sendMessage({ - type: "setSlogans", - value: array - }); - request.then(function() { - location.reload(); - }, handleError); - } - - // Add event listener to checkbox - var checkbox = document.getElementById('tonight'); - if (darkmode) { - checkbox.checked = true; - } - checkbox.addEventListener('click', function(event) { - // Update value in local storage - request = browser.runtime.sendMessage({ - type: "setTonight", - value: checkbox.checked - }); - // Reload all SOMtoday tabs - var reload = browser.tabs.query({}); - reload.then(logTabs, onError); - }); - - // Find id of somtoday.nl tab - function logTabs(tabs) { - for (let tab of tabs) { - // Match only tabs with url somtoday.nl - if (tab.url.includes('somtoday.nl')) { - browser.tabs.sendMessage(tab.id, 'reload'); + // Remove a slogan from the array + function removeSlogan (id) { + const array = [] + if (sloganArray.length > 1) { + for (let index = 0; index < sloganArray.length; index++) { + const element = sloganArray[index] + if (index !== id) { + array.push(element) } } + updateSlogans(array) + } else { + window.alert('U kunt de laatste slogan niet verwijderen.') } + } - // Handle query errors - function onError(error) { - console.log(`Error: ${error}`); + // Send updated array to background script + function updateSlogans (array) { + request = browser.runtime.sendMessage({ + type: 'setSlogans', + value: array + }) + request.then(function () { + location.reload() + }, handleError) + } + + // Add event listener to checkbox + const checkbox = document.getElementById('tonight') + if (darkmode) { + checkbox.checked = true + } + checkbox.addEventListener('click', function (event) { + // Update value in local storage + request = browser.runtime.sendMessage({ + type: 'setTonight', + value: checkbox.checked + }) + // Reload all SOMtoday tabs + const reload = browser.tabs.query({}) + reload.then(logTabs, onError) + }) + + // Find id of somtoday.nl tab + function logTabs (tabs) { + for (const tab of tabs) { + // Match only tabs with url somtoday.nl + if (tab.url.includes('somtoday.nl')) { + browser.tabs.sendMessage(tab.id, 'reload') + } } + } - // Add existing slogans to list items in the popup - var sloganList = ''; - for (let index = 0; index < sloganArray.length; index++) { - const element = sloganArray[index]; - sloganList = sloganList + ``; - } - document.getElementById('sloganList').innerHTML = sloganList; + // Handle query errors + function onError (error) { + console.log(`Error: ${error}`) + } - // Get value for new slogan - document.getElementById('sloganForm').addEventListener('submit', function(event) { - event.preventDefault(); - addSlogan(event.target.children[0].value); - event.target.children[0].value = ''; - }); + // Add existing slogans to list items in the popup + let sloganList = '' + for (let index = 0; index < sloganArray.length; index++) { + const element = sloganArray[index] + sloganList = sloganList + `` + } + document.getElementById('sloganList').innerHTML = sloganList - // Add event listener to every list item for deleting slogans - var listElements = document.querySelectorAll("div#sloganList > ul"); - for (let index = 0; index < listElements.length; index++) { - const element = listElements[index]; - element.addEventListener("click", function() { - removeSlogan(index); - }); - } + // Get value for new slogan + document.getElementById('sloganForm').addEventListener('submit', function (event) { + event.preventDefault() + addSlogan(event.target.children[0].value) + event.target.children[0].value = '' + }) -}, handleError); + // Add event listener to every list item for deleting slogans + const listElements = document.querySelectorAll('div#sloganList > ul') + for (let index = 0; index < listElements.length; index++) { + const element = listElements[index] + element.addEventListener('click', function () { + removeSlogan(index) + }) + } +}, handleError) -function handleError(error) { - console.error(`SOMtodayn't Error: ${error}`); +function handleError (error) { + console.error(`SOMtodayn't Error: ${error}`) } - diff --git a/vendor/browser-polyfill.js b/vendor/browser-polyfill.js index 8c2afd6..91ba9f5 100644 --- a/vendor/browser-polyfill.js +++ b/vendor/browser-polyfill.js @@ -1,14 +1,14 @@ (function (global, factory) { - if (typeof define === "function" && define.amd) { - define("webextension-polyfill", ["module"], factory); - } else if (typeof exports !== "undefined") { - factory(module); + if (typeof define === 'function' && define.amd) { + define('webextension-polyfill', ['module'], factory) + } else if (typeof exports !== 'undefined') { + factory(module) } else { - var mod = { + const mod = { exports: {} - }; - factory(mod); - global.browser = mod.exports; + } + factory(mod) + global.browser = mod.exports } })(this, function (module) { /* webextension-polyfill - v0.5.0 - Thu Sep 26 2019 22:22:26 */ @@ -17,11 +17,11 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - "use strict"; + 'use strict' - if (typeof browser === "undefined" || Object.getPrototypeOf(browser) !== Object.prototype) { - const CHROME_SEND_MESSAGE_CALLBACK_NO_RESPONSE_MESSAGE = "The message port closed before a response was received."; - const SEND_RESPONSE_DEPRECATION_WARNING = "Returning a Promise is the preferred way to send a reply from an onMessage/onMessageExternal listener, as the sendResponse will be removed from the specs (See https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage)"; + if (typeof browser === 'undefined' || Object.getPrototypeOf(browser) !== Object.prototype) { + const CHROME_SEND_MESSAGE_CALLBACK_NO_RESPONSE_MESSAGE = 'The message port closed before a response was received.' + const SEND_RESPONSE_DEPRECATION_WARNING = 'Returning a Promise is the preferred way to send a reply from an onMessage/onMessageExternal listener, as the sendResponse will be removed from the specs (See https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage)' // Wrapping the bulk of this polyfill in a one-time-use function is a minor // optimization for Firefox. Since Spidermonkey does not fully parse the @@ -33,666 +33,666 @@ // at build time by replacing the following "include" with the content of the // JSON file. const apiMetadata = { - "alarms": { - "clear": { - "minArgs": 0, - "maxArgs": 1 + alarms: { + clear: { + minArgs: 0, + maxArgs: 1 }, - "clearAll": { - "minArgs": 0, - "maxArgs": 0 + clearAll: { + minArgs: 0, + maxArgs: 0 }, - "get": { - "minArgs": 0, - "maxArgs": 1 + get: { + minArgs: 0, + maxArgs: 1 }, - "getAll": { - "minArgs": 0, - "maxArgs": 0 + getAll: { + minArgs: 0, + maxArgs: 0 } }, - "bookmarks": { - "create": { - "minArgs": 1, - "maxArgs": 1 + bookmarks: { + create: { + minArgs: 1, + maxArgs: 1 }, - "get": { - "minArgs": 1, - "maxArgs": 1 + get: { + minArgs: 1, + maxArgs: 1 }, - "getChildren": { - "minArgs": 1, - "maxArgs": 1 + getChildren: { + minArgs: 1, + maxArgs: 1 }, - "getRecent": { - "minArgs": 1, - "maxArgs": 1 + getRecent: { + minArgs: 1, + maxArgs: 1 }, - "getSubTree": { - "minArgs": 1, - "maxArgs": 1 + getSubTree: { + minArgs: 1, + maxArgs: 1 }, - "getTree": { - "minArgs": 0, - "maxArgs": 0 + getTree: { + minArgs: 0, + maxArgs: 0 }, - "move": { - "minArgs": 2, - "maxArgs": 2 + move: { + minArgs: 2, + maxArgs: 2 }, - "remove": { - "minArgs": 1, - "maxArgs": 1 + remove: { + minArgs: 1, + maxArgs: 1 }, - "removeTree": { - "minArgs": 1, - "maxArgs": 1 + removeTree: { + minArgs: 1, + maxArgs: 1 }, - "search": { - "minArgs": 1, - "maxArgs": 1 + search: { + minArgs: 1, + maxArgs: 1 }, - "update": { - "minArgs": 2, - "maxArgs": 2 + update: { + minArgs: 2, + maxArgs: 2 } }, - "browserAction": { - "disable": { - "minArgs": 0, - "maxArgs": 1, - "fallbackToNoCallback": true + browserAction: { + disable: { + minArgs: 0, + maxArgs: 1, + fallbackToNoCallback: true }, - "enable": { - "minArgs": 0, - "maxArgs": 1, - "fallbackToNoCallback": true + enable: { + minArgs: 0, + maxArgs: 1, + fallbackToNoCallback: true }, - "getBadgeBackgroundColor": { - "minArgs": 1, - "maxArgs": 1 + getBadgeBackgroundColor: { + minArgs: 1, + maxArgs: 1 }, - "getBadgeText": { - "minArgs": 1, - "maxArgs": 1 + getBadgeText: { + minArgs: 1, + maxArgs: 1 }, - "getPopup": { - "minArgs": 1, - "maxArgs": 1 + getPopup: { + minArgs: 1, + maxArgs: 1 }, - "getTitle": { - "minArgs": 1, - "maxArgs": 1 + getTitle: { + minArgs: 1, + maxArgs: 1 }, - "openPopup": { - "minArgs": 0, - "maxArgs": 0 + openPopup: { + minArgs: 0, + maxArgs: 0 }, - "setBadgeBackgroundColor": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + setBadgeBackgroundColor: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true }, - "setBadgeText": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + setBadgeText: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true }, - "setIcon": { - "minArgs": 1, - "maxArgs": 1 + setIcon: { + minArgs: 1, + maxArgs: 1 }, - "setPopup": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + setPopup: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true }, - "setTitle": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + setTitle: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true } }, - "browsingData": { - "remove": { - "minArgs": 2, - "maxArgs": 2 + browsingData: { + remove: { + minArgs: 2, + maxArgs: 2 }, - "removeCache": { - "minArgs": 1, - "maxArgs": 1 + removeCache: { + minArgs: 1, + maxArgs: 1 }, - "removeCookies": { - "minArgs": 1, - "maxArgs": 1 + removeCookies: { + minArgs: 1, + maxArgs: 1 }, - "removeDownloads": { - "minArgs": 1, - "maxArgs": 1 + removeDownloads: { + minArgs: 1, + maxArgs: 1 }, - "removeFormData": { - "minArgs": 1, - "maxArgs": 1 + removeFormData: { + minArgs: 1, + maxArgs: 1 }, - "removeHistory": { - "minArgs": 1, - "maxArgs": 1 + removeHistory: { + minArgs: 1, + maxArgs: 1 }, - "removeLocalStorage": { - "minArgs": 1, - "maxArgs": 1 + removeLocalStorage: { + minArgs: 1, + maxArgs: 1 }, - "removePasswords": { - "minArgs": 1, - "maxArgs": 1 + removePasswords: { + minArgs: 1, + maxArgs: 1 }, - "removePluginData": { - "minArgs": 1, - "maxArgs": 1 + removePluginData: { + minArgs: 1, + maxArgs: 1 }, - "settings": { - "minArgs": 0, - "maxArgs": 0 + settings: { + minArgs: 0, + maxArgs: 0 } }, - "commands": { - "getAll": { - "minArgs": 0, - "maxArgs": 0 + commands: { + getAll: { + minArgs: 0, + maxArgs: 0 } }, - "contextMenus": { - "remove": { - "minArgs": 1, - "maxArgs": 1 + contextMenus: { + remove: { + minArgs: 1, + maxArgs: 1 }, - "removeAll": { - "minArgs": 0, - "maxArgs": 0 + removeAll: { + minArgs: 0, + maxArgs: 0 }, - "update": { - "minArgs": 2, - "maxArgs": 2 + update: { + minArgs: 2, + maxArgs: 2 } }, - "cookies": { - "get": { - "minArgs": 1, - "maxArgs": 1 + cookies: { + get: { + minArgs: 1, + maxArgs: 1 }, - "getAll": { - "minArgs": 1, - "maxArgs": 1 + getAll: { + minArgs: 1, + maxArgs: 1 }, - "getAllCookieStores": { - "minArgs": 0, - "maxArgs": 0 + getAllCookieStores: { + minArgs: 0, + maxArgs: 0 }, - "remove": { - "minArgs": 1, - "maxArgs": 1 + remove: { + minArgs: 1, + maxArgs: 1 }, - "set": { - "minArgs": 1, - "maxArgs": 1 + set: { + minArgs: 1, + maxArgs: 1 } }, - "devtools": { - "inspectedWindow": { - "eval": { - "minArgs": 1, - "maxArgs": 2, - "singleCallbackArg": false + devtools: { + inspectedWindow: { + eval: { + minArgs: 1, + maxArgs: 2, + singleCallbackArg: false } }, - "panels": { - "create": { - "minArgs": 3, - "maxArgs": 3, - "singleCallbackArg": true + panels: { + create: { + minArgs: 3, + maxArgs: 3, + singleCallbackArg: true } } }, - "downloads": { - "cancel": { - "minArgs": 1, - "maxArgs": 1 + downloads: { + cancel: { + minArgs: 1, + maxArgs: 1 }, - "download": { - "minArgs": 1, - "maxArgs": 1 + download: { + minArgs: 1, + maxArgs: 1 }, - "erase": { - "minArgs": 1, - "maxArgs": 1 + erase: { + minArgs: 1, + maxArgs: 1 }, - "getFileIcon": { - "minArgs": 1, - "maxArgs": 2 + getFileIcon: { + minArgs: 1, + maxArgs: 2 }, - "open": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + open: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true }, - "pause": { - "minArgs": 1, - "maxArgs": 1 + pause: { + minArgs: 1, + maxArgs: 1 }, - "removeFile": { - "minArgs": 1, - "maxArgs": 1 + removeFile: { + minArgs: 1, + maxArgs: 1 }, - "resume": { - "minArgs": 1, - "maxArgs": 1 + resume: { + minArgs: 1, + maxArgs: 1 }, - "search": { - "minArgs": 1, - "maxArgs": 1 + search: { + minArgs: 1, + maxArgs: 1 }, - "show": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + show: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true } }, - "extension": { - "isAllowedFileSchemeAccess": { - "minArgs": 0, - "maxArgs": 0 + extension: { + isAllowedFileSchemeAccess: { + minArgs: 0, + maxArgs: 0 }, - "isAllowedIncognitoAccess": { - "minArgs": 0, - "maxArgs": 0 + isAllowedIncognitoAccess: { + minArgs: 0, + maxArgs: 0 } }, - "history": { - "addUrl": { - "minArgs": 1, - "maxArgs": 1 + history: { + addUrl: { + minArgs: 1, + maxArgs: 1 }, - "deleteAll": { - "minArgs": 0, - "maxArgs": 0 + deleteAll: { + minArgs: 0, + maxArgs: 0 }, - "deleteRange": { - "minArgs": 1, - "maxArgs": 1 + deleteRange: { + minArgs: 1, + maxArgs: 1 }, - "deleteUrl": { - "minArgs": 1, - "maxArgs": 1 + deleteUrl: { + minArgs: 1, + maxArgs: 1 }, - "getVisits": { - "minArgs": 1, - "maxArgs": 1 + getVisits: { + minArgs: 1, + maxArgs: 1 }, - "search": { - "minArgs": 1, - "maxArgs": 1 + search: { + minArgs: 1, + maxArgs: 1 } }, - "i18n": { - "detectLanguage": { - "minArgs": 1, - "maxArgs": 1 + i18n: { + detectLanguage: { + minArgs: 1, + maxArgs: 1 }, - "getAcceptLanguages": { - "minArgs": 0, - "maxArgs": 0 + getAcceptLanguages: { + minArgs: 0, + maxArgs: 0 } }, - "identity": { - "launchWebAuthFlow": { - "minArgs": 1, - "maxArgs": 1 + identity: { + launchWebAuthFlow: { + minArgs: 1, + maxArgs: 1 } }, - "idle": { - "queryState": { - "minArgs": 1, - "maxArgs": 1 + idle: { + queryState: { + minArgs: 1, + maxArgs: 1 } }, - "management": { - "get": { - "minArgs": 1, - "maxArgs": 1 + management: { + get: { + minArgs: 1, + maxArgs: 1 }, - "getAll": { - "minArgs": 0, - "maxArgs": 0 + getAll: { + minArgs: 0, + maxArgs: 0 }, - "getSelf": { - "minArgs": 0, - "maxArgs": 0 + getSelf: { + minArgs: 0, + maxArgs: 0 }, - "setEnabled": { - "minArgs": 2, - "maxArgs": 2 + setEnabled: { + minArgs: 2, + maxArgs: 2 }, - "uninstallSelf": { - "minArgs": 0, - "maxArgs": 1 + uninstallSelf: { + minArgs: 0, + maxArgs: 1 } }, - "notifications": { - "clear": { - "minArgs": 1, - "maxArgs": 1 + notifications: { + clear: { + minArgs: 1, + maxArgs: 1 }, - "create": { - "minArgs": 1, - "maxArgs": 2 + create: { + minArgs: 1, + maxArgs: 2 }, - "getAll": { - "minArgs": 0, - "maxArgs": 0 + getAll: { + minArgs: 0, + maxArgs: 0 }, - "getPermissionLevel": { - "minArgs": 0, - "maxArgs": 0 + getPermissionLevel: { + minArgs: 0, + maxArgs: 0 }, - "update": { - "minArgs": 2, - "maxArgs": 2 + update: { + minArgs: 2, + maxArgs: 2 } }, - "pageAction": { - "getPopup": { - "minArgs": 1, - "maxArgs": 1 + pageAction: { + getPopup: { + minArgs: 1, + maxArgs: 1 }, - "getTitle": { - "minArgs": 1, - "maxArgs": 1 + getTitle: { + minArgs: 1, + maxArgs: 1 }, - "hide": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + hide: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true }, - "setIcon": { - "minArgs": 1, - "maxArgs": 1 + setIcon: { + minArgs: 1, + maxArgs: 1 }, - "setPopup": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + setPopup: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true }, - "setTitle": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + setTitle: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true }, - "show": { - "minArgs": 1, - "maxArgs": 1, - "fallbackToNoCallback": true + show: { + minArgs: 1, + maxArgs: 1, + fallbackToNoCallback: true } }, - "permissions": { - "contains": { - "minArgs": 1, - "maxArgs": 1 + permissions: { + contains: { + minArgs: 1, + maxArgs: 1 }, - "getAll": { - "minArgs": 0, - "maxArgs": 0 + getAll: { + minArgs: 0, + maxArgs: 0 }, - "remove": { - "minArgs": 1, - "maxArgs": 1 + remove: { + minArgs: 1, + maxArgs: 1 }, - "request": { - "minArgs": 1, - "maxArgs": 1 + request: { + minArgs: 1, + maxArgs: 1 } }, - "runtime": { - "getBackgroundPage": { - "minArgs": 0, - "maxArgs": 0 + runtime: { + getBackgroundPage: { + minArgs: 0, + maxArgs: 0 }, - "getPlatformInfo": { - "minArgs": 0, - "maxArgs": 0 + getPlatformInfo: { + minArgs: 0, + maxArgs: 0 }, - "openOptionsPage": { - "minArgs": 0, - "maxArgs": 0 + openOptionsPage: { + minArgs: 0, + maxArgs: 0 }, - "requestUpdateCheck": { - "minArgs": 0, - "maxArgs": 0 + requestUpdateCheck: { + minArgs: 0, + maxArgs: 0 }, - "sendMessage": { - "minArgs": 1, - "maxArgs": 3 + sendMessage: { + minArgs: 1, + maxArgs: 3 }, - "sendNativeMessage": { - "minArgs": 2, - "maxArgs": 2 + sendNativeMessage: { + minArgs: 2, + maxArgs: 2 }, - "setUninstallURL": { - "minArgs": 1, - "maxArgs": 1 + setUninstallURL: { + minArgs: 1, + maxArgs: 1 } }, - "sessions": { - "getDevices": { - "minArgs": 0, - "maxArgs": 1 + sessions: { + getDevices: { + minArgs: 0, + maxArgs: 1 }, - "getRecentlyClosed": { - "minArgs": 0, - "maxArgs": 1 + getRecentlyClosed: { + minArgs: 0, + maxArgs: 1 }, - "restore": { - "minArgs": 0, - "maxArgs": 1 + restore: { + minArgs: 0, + maxArgs: 1 } }, - "storage": { - "local": { - "clear": { - "minArgs": 0, - "maxArgs": 0 + storage: { + local: { + clear: { + minArgs: 0, + maxArgs: 0 }, - "get": { - "minArgs": 0, - "maxArgs": 1 + get: { + minArgs: 0, + maxArgs: 1 }, - "getBytesInUse": { - "minArgs": 0, - "maxArgs": 1 + getBytesInUse: { + minArgs: 0, + maxArgs: 1 }, - "remove": { - "minArgs": 1, - "maxArgs": 1 + remove: { + minArgs: 1, + maxArgs: 1 }, - "set": { - "minArgs": 1, - "maxArgs": 1 + set: { + minArgs: 1, + maxArgs: 1 } }, - "managed": { - "get": { - "minArgs": 0, - "maxArgs": 1 + managed: { + get: { + minArgs: 0, + maxArgs: 1 }, - "getBytesInUse": { - "minArgs": 0, - "maxArgs": 1 + getBytesInUse: { + minArgs: 0, + maxArgs: 1 } }, - "sync": { - "clear": { - "minArgs": 0, - "maxArgs": 0 + sync: { + clear: { + minArgs: 0, + maxArgs: 0 }, - "get": { - "minArgs": 0, - "maxArgs": 1 + get: { + minArgs: 0, + maxArgs: 1 }, - "getBytesInUse": { - "minArgs": 0, - "maxArgs": 1 + getBytesInUse: { + minArgs: 0, + maxArgs: 1 }, - "remove": { - "minArgs": 1, - "maxArgs": 1 + remove: { + minArgs: 1, + maxArgs: 1 }, - "set": { - "minArgs": 1, - "maxArgs": 1 + set: { + minArgs: 1, + maxArgs: 1 } } }, - "tabs": { - "captureVisibleTab": { - "minArgs": 0, - "maxArgs": 2 + tabs: { + captureVisibleTab: { + minArgs: 0, + maxArgs: 2 }, - "create": { - "minArgs": 1, - "maxArgs": 1 + create: { + minArgs: 1, + maxArgs: 1 }, - "detectLanguage": { - "minArgs": 0, - "maxArgs": 1 + detectLanguage: { + minArgs: 0, + maxArgs: 1 }, - "discard": { - "minArgs": 0, - "maxArgs": 1 + discard: { + minArgs: 0, + maxArgs: 1 }, - "duplicate": { - "minArgs": 1, - "maxArgs": 1 + duplicate: { + minArgs: 1, + maxArgs: 1 }, - "executeScript": { - "minArgs": 1, - "maxArgs": 2 + executeScript: { + minArgs: 1, + maxArgs: 2 }, - "get": { - "minArgs": 1, - "maxArgs": 1 + get: { + minArgs: 1, + maxArgs: 1 }, - "getCurrent": { - "minArgs": 0, - "maxArgs": 0 + getCurrent: { + minArgs: 0, + maxArgs: 0 }, - "getZoom": { - "minArgs": 0, - "maxArgs": 1 + getZoom: { + minArgs: 0, + maxArgs: 1 }, - "getZoomSettings": { - "minArgs": 0, - "maxArgs": 1 + getZoomSettings: { + minArgs: 0, + maxArgs: 1 }, - "highlight": { - "minArgs": 1, - "maxArgs": 1 + highlight: { + minArgs: 1, + maxArgs: 1 }, - "insertCSS": { - "minArgs": 1, - "maxArgs": 2 + insertCSS: { + minArgs: 1, + maxArgs: 2 }, - "move": { - "minArgs": 2, - "maxArgs": 2 + move: { + minArgs: 2, + maxArgs: 2 }, - "query": { - "minArgs": 1, - "maxArgs": 1 + query: { + minArgs: 1, + maxArgs: 1 }, - "reload": { - "minArgs": 0, - "maxArgs": 2 + reload: { + minArgs: 0, + maxArgs: 2 }, - "remove": { - "minArgs": 1, - "maxArgs": 1 + remove: { + minArgs: 1, + maxArgs: 1 }, - "removeCSS": { - "minArgs": 1, - "maxArgs": 2 + removeCSS: { + minArgs: 1, + maxArgs: 2 }, - "sendMessage": { - "minArgs": 2, - "maxArgs": 3 + sendMessage: { + minArgs: 2, + maxArgs: 3 }, - "setZoom": { - "minArgs": 1, - "maxArgs": 2 + setZoom: { + minArgs: 1, + maxArgs: 2 }, - "setZoomSettings": { - "minArgs": 1, - "maxArgs": 2 + setZoomSettings: { + minArgs: 1, + maxArgs: 2 }, - "update": { - "minArgs": 1, - "maxArgs": 2 + update: { + minArgs: 1, + maxArgs: 2 } }, - "topSites": { - "get": { - "minArgs": 0, - "maxArgs": 0 + topSites: { + get: { + minArgs: 0, + maxArgs: 0 } }, - "webNavigation": { - "getAllFrames": { - "minArgs": 1, - "maxArgs": 1 + webNavigation: { + getAllFrames: { + minArgs: 1, + maxArgs: 1 }, - "getFrame": { - "minArgs": 1, - "maxArgs": 1 + getFrame: { + minArgs: 1, + maxArgs: 1 } }, - "webRequest": { - "handlerBehaviorChanged": { - "minArgs": 0, - "maxArgs": 0 + webRequest: { + handlerBehaviorChanged: { + minArgs: 0, + maxArgs: 0 } }, - "windows": { - "create": { - "minArgs": 0, - "maxArgs": 1 + windows: { + create: { + minArgs: 0, + maxArgs: 1 }, - "get": { - "minArgs": 1, - "maxArgs": 2 + get: { + minArgs: 1, + maxArgs: 2 }, - "getAll": { - "minArgs": 0, - "maxArgs": 1 + getAll: { + minArgs: 0, + maxArgs: 1 }, - "getCurrent": { - "minArgs": 0, - "maxArgs": 1 + getCurrent: { + minArgs: 0, + maxArgs: 1 }, - "getLastFocused": { - "minArgs": 0, - "maxArgs": 1 + getLastFocused: { + minArgs: 0, + maxArgs: 1 }, - "remove": { - "minArgs": 1, - "maxArgs": 1 + remove: { + minArgs: 1, + maxArgs: 1 }, - "update": { - "minArgs": 2, - "maxArgs": 2 + update: { + minArgs: 2, + maxArgs: 2 } } - }; + } if (Object.keys(apiMetadata).length === 0) { - throw new Error("api-metadata.json has not been included in browser-polyfill"); + throw new Error('api-metadata.json has not been included in browser-polyfill') } /** @@ -706,17 +706,17 @@ * function receives, as its only argument, the key being created. */ class DefaultWeakMap extends WeakMap { - constructor(createItem, items = undefined) { - super(items); - this.createItem = createItem; + constructor (createItem, items = undefined) { + super(items) + this.createItem = createItem } - get(key) { + get (key) { if (!this.has(key)) { - this.set(key, this.createItem(key)); + this.set(key, this.createItem(key)) } - return super.get(key); + return super.get(key) } } @@ -728,8 +728,8 @@ * @returns {boolean} True if the value is thenable. */ const isThenable = value => { - return value && typeof value === "object" && typeof value.then === "function"; - }; + return value && typeof value === 'object' && typeof value.then === 'function' + } /** * Creates and returns a function which, when called, will resolve or reject @@ -761,16 +761,16 @@ const makeCallback = (promise, metadata) => { return (...callbackArgs) => { if (extensionAPIs.runtime.lastError) { - promise.reject(extensionAPIs.runtime.lastError); + promise.reject(extensionAPIs.runtime.lastError) } else if (metadata.singleCallbackArg || callbackArgs.length <= 1 && metadata.singleCallbackArg !== false) { - promise.resolve(callbackArgs[0]); + promise.resolve(callbackArgs[0]) } else { - promise.resolve(callbackArgs); + promise.resolve(callbackArgs) } - }; - }; + } + } - const pluralizeArguments = numArgs => numArgs == 1 ? "argument" : "arguments"; + const pluralizeArguments = numArgs => numArgs == 1 ? 'argument' : 'arguments' /** * Creates a wrapper function for a method with the given name and metadata. @@ -795,13 +795,13 @@ * The generated wrapper function. */ const wrapAsyncFunction = (name, metadata) => { - return function asyncFunctionWrapper(target, ...args) { + return function asyncFunctionWrapper (target, ...args) { if (args.length < metadata.minArgs) { - throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`); + throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`) } if (args.length > metadata.maxArgs) { - throw new Error(`Expected at most ${metadata.maxArgs} ${pluralizeArguments(metadata.maxArgs)} for ${name}(), got ${args.length}`); + throw new Error(`Expected at most ${metadata.maxArgs} ${pluralizeArguments(metadata.maxArgs)} for ${name}(), got ${args.length}`) } return new Promise((resolve, reject) => { @@ -810,28 +810,28 @@ // and so the polyfill will try to call it with a callback first, and it will fallback // to not passing the callback if the first call fails. try { - target[name](...args, makeCallback({ resolve, reject }, metadata)); + target[name](...args, makeCallback({ resolve, reject }, metadata)) } catch (cbError) { - console.warn(`${name} API method doesn't seem to support the callback parameter, ` + "falling back to call it without a callback: ", cbError); + console.warn(`${name} API method doesn't seem to support the callback parameter, ` + 'falling back to call it without a callback: ', cbError) - target[name](...args); + target[name](...args) // Update the API method metadata, so that the next API calls will not try to // use the unsupported callback anymore. - metadata.fallbackToNoCallback = false; - metadata.noCallback = true; + metadata.fallbackToNoCallback = false + metadata.noCallback = true - resolve(); + resolve() } } else if (metadata.noCallback) { - target[name](...args); - resolve(); + target[name](...args) + resolve() } else { - target[name](...args, makeCallback({ resolve, reject }, metadata)); + target[name](...args, makeCallback({ resolve, reject }, metadata)) } - }); - }; - }; + }) + } + } /** * Wraps an existing method of the target object, so that calls to it are @@ -854,13 +854,13 @@ */ const wrapMethod = (target, method, wrapper) => { return new Proxy(method, { - apply(targetMethod, thisObj, args) { - return wrapper.call(thisObj, target, ...args); + apply (targetMethod, thisObj, args) { + return wrapper.call(thisObj, target, ...args) } - }); - }; + }) + } - let hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty); + const hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty) /** * Wraps an object in a Proxy which intercepts and wraps certain methods @@ -886,83 +886,83 @@ * @returns {Proxy} */ const wrapObject = (target, wrappers = {}, metadata = {}) => { - let cache = Object.create(null); - let handlers = { - has(proxyTarget, prop) { - return prop in target || prop in cache; + const cache = Object.create(null) + const handlers = { + has (proxyTarget, prop) { + return prop in target || prop in cache }, - get(proxyTarget, prop, receiver) { + get (proxyTarget, prop, receiver) { if (prop in cache) { - return cache[prop]; + return cache[prop] } if (!(prop in target)) { - return undefined; + return undefined } - let value = target[prop]; + let value = target[prop] - if (typeof value === "function") { + if (typeof value === 'function') { // This is a method on the underlying object. Check if we need to do // any wrapping. - if (typeof wrappers[prop] === "function") { + if (typeof wrappers[prop] === 'function') { // We have a special-case wrapper for this method. - value = wrapMethod(target, target[prop], wrappers[prop]); + value = wrapMethod(target, target[prop], wrappers[prop]) } else if (hasOwnProperty(metadata, prop)) { // This is an async method that we have metadata for. Create a // Promise wrapper for it. - let wrapper = wrapAsyncFunction(prop, metadata[prop]); - value = wrapMethod(target, target[prop], wrapper); + const wrapper = wrapAsyncFunction(prop, metadata[prop]) + value = wrapMethod(target, target[prop], wrapper) } else { // This is a method that we don't know or care about. Return the // original method, bound to the underlying object. - value = value.bind(target); + value = value.bind(target) } - } else if (typeof value === "object" && value !== null && (hasOwnProperty(wrappers, prop) || hasOwnProperty(metadata, prop))) { + } else if (typeof value === 'object' && value !== null && (hasOwnProperty(wrappers, prop) || hasOwnProperty(metadata, prop))) { // This is an object that we need to do some wrapping for the children // of. Create a sub-object wrapper for it with the appropriate child // metadata. - value = wrapObject(value, wrappers[prop], metadata[prop]); + value = wrapObject(value, wrappers[prop], metadata[prop]) } else { // We don't need to do any wrapping for this property, // so just forward all access to the underlying object. Object.defineProperty(cache, prop, { configurable: true, enumerable: true, - get() { - return target[prop]; + get () { + return target[prop] }, - set(value) { - target[prop] = value; + set (value) { + target[prop] = value } - }); + }) - return value; + return value } - cache[prop] = value; - return value; + cache[prop] = value + return value }, - set(proxyTarget, prop, value, receiver) { + set (proxyTarget, prop, value, receiver) { if (prop in cache) { - cache[prop] = value; + cache[prop] = value } else { - target[prop] = value; + target[prop] = value } - return true; + return true }, - defineProperty(proxyTarget, prop, desc) { - return Reflect.defineProperty(cache, prop, desc); + defineProperty (proxyTarget, prop, desc) { + return Reflect.defineProperty(cache, prop, desc) }, - deleteProperty(proxyTarget, prop) { - return Reflect.deleteProperty(cache, prop); + deleteProperty (proxyTarget, prop) { + return Reflect.deleteProperty(cache, prop) } - }; + } // Per contract of the Proxy API, the "get" proxy handler must return the // original value of the target if that value is declared read-only and @@ -974,9 +974,9 @@ // The proxy handlers themselves will still use the original `target` // instead of the `proxyTarget`, so that the methods and properties are // dereferenced via the original targets. - let proxyTarget = Object.create(target); - return new Proxy(proxyTarget, handlers); - }; + const proxyTarget = Object.create(target) + return new Proxy(proxyTarget, handlers) + } /** * Creates a set of wrapper functions for an event object, which handles @@ -995,25 +995,25 @@ * @returns {object} */ const wrapEvent = wrapperMap => ({ - addListener(target, listener, ...args) { - target.addListener(wrapperMap.get(listener), ...args); + addListener (target, listener, ...args) { + target.addListener(wrapperMap.get(listener), ...args) }, - hasListener(target, listener) { - return target.hasListener(wrapperMap.get(listener)); + hasListener (target, listener) { + return target.hasListener(wrapperMap.get(listener)) }, - removeListener(target, listener) { - target.removeListener(wrapperMap.get(listener)); + removeListener (target, listener) { + target.removeListener(wrapperMap.get(listener)) } - }); + }) // Keep track if the deprecation warning has been logged at least once. - let loggedSendResponseDeprecationWarning = false; + let loggedSendResponseDeprecationWarning = false const onMessageWrappers = new DefaultWeakMap(listener => { - if (typeof listener !== "function") { - return listener; + if (typeof listener !== 'function') { + return listener } /** @@ -1033,35 +1033,35 @@ * True if the wrapped listener returned a Promise, which will later * yield a response. False otherwise. */ - return function onMessage(message, sender, sendResponse) { - let didCallSendResponse = false; + return function onMessage (message, sender, sendResponse) { + let didCallSendResponse = false - let wrappedSendResponse; - let sendResponsePromise = new Promise(resolve => { + let wrappedSendResponse + const sendResponsePromise = new Promise(resolve => { wrappedSendResponse = function (response) { if (!loggedSendResponseDeprecationWarning) { - console.warn(SEND_RESPONSE_DEPRECATION_WARNING, new Error().stack); - loggedSendResponseDeprecationWarning = true; + console.warn(SEND_RESPONSE_DEPRECATION_WARNING, new Error().stack) + loggedSendResponseDeprecationWarning = true } - didCallSendResponse = true; - resolve(response); - }; - }); + didCallSendResponse = true + resolve(response) + } + }) - let result; + let result try { - result = listener(message, sender, wrappedSendResponse); + result = listener(message, sender, wrappedSendResponse) } catch (err) { - result = Promise.reject(err); + result = Promise.reject(err) } - const isResultThenable = result !== true && isThenable(result); + const isResultThenable = result !== true && isThenable(result) // If the listener didn't returned true or a Promise, or called // wrappedSendResponse synchronously, we can exit earlier // because there will be no response sent from this listener. if (result !== true && !isResultThenable && !didCallSendResponse) { - return false; + return false } // A small helper to send the message if the promise resolves @@ -1071,40 +1071,40 @@ const sendPromisedResult = promise => { promise.then(msg => { // send the message value. - sendResponse(msg); + sendResponse(msg) }, error => { // Send a JSON representation of the error if the rejected value // is an instance of error, or the object itself otherwise. - let message; - if (error && (error instanceof Error || typeof error.message === "string")) { - message = error.message; + let message + if (error && (error instanceof Error || typeof error.message === 'string')) { + message = error.message } else { - message = "An unexpected error occurred"; + message = 'An unexpected error occurred' } sendResponse({ __mozWebExtensionPolyfillReject__: true, message - }); + }) }).catch(err => { // Print an error on the console if unable to send the response. - console.error("Failed to send onMessage rejected reply", err); - }); - }; + console.error('Failed to send onMessage rejected reply', err) + }) + } // If the listener returned a Promise, send the resolved value as a // result, otherwise wait the promise related to the wrappedSendResponse // callback to resolve and send it as a response. if (isResultThenable) { - sendPromisedResult(result); + sendPromisedResult(result) } else { - sendPromisedResult(sendResponsePromise); + sendPromisedResult(sendResponsePromise) } // Let Chrome know that the listener is replying. - return true; - }; - }); + return true + } + }) const wrappedSendMessageCallback = ({ reject, resolve }, reply) => { if (extensionAPIs.runtime.lastError) { @@ -1112,50 +1112,50 @@ // the promise to undefined as in Firefox. // See https://github.com/mozilla/webextension-polyfill/issues/130 if (extensionAPIs.runtime.lastError.message === CHROME_SEND_MESSAGE_CALLBACK_NO_RESPONSE_MESSAGE) { - resolve(); + resolve() } else { - reject(extensionAPIs.runtime.lastError); + reject(extensionAPIs.runtime.lastError) } } else if (reply && reply.__mozWebExtensionPolyfillReject__) { // Convert back the JSON representation of the error into // an Error instance. - reject(new Error(reply.message)); + reject(new Error(reply.message)) } else { - resolve(reply); + resolve(reply) } - }; + } const wrappedSendMessage = (name, metadata, apiNamespaceObj, ...args) => { if (args.length < metadata.minArgs) { - throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`); + throw new Error(`Expected at least ${metadata.minArgs} ${pluralizeArguments(metadata.minArgs)} for ${name}(), got ${args.length}`) } if (args.length > metadata.maxArgs) { - throw new Error(`Expected at most ${metadata.maxArgs} ${pluralizeArguments(metadata.maxArgs)} for ${name}(), got ${args.length}`); + throw new Error(`Expected at most ${metadata.maxArgs} ${pluralizeArguments(metadata.maxArgs)} for ${name}(), got ${args.length}`) } return new Promise((resolve, reject) => { - const wrappedCb = wrappedSendMessageCallback.bind(null, { resolve, reject }); - args.push(wrappedCb); - apiNamespaceObj.sendMessage(...args); - }); - }; + const wrappedCb = wrappedSendMessageCallback.bind(null, { resolve, reject }) + args.push(wrappedCb) + apiNamespaceObj.sendMessage(...args) + }) + } const staticWrappers = { runtime: { onMessage: wrapEvent(onMessageWrappers), onMessageExternal: wrapEvent(onMessageWrappers), - sendMessage: wrappedSendMessage.bind(null, "sendMessage", { minArgs: 1, maxArgs: 3 }) + sendMessage: wrappedSendMessage.bind(null, 'sendMessage', { minArgs: 1, maxArgs: 3 }) }, tabs: { - sendMessage: wrappedSendMessage.bind(null, "sendMessage", { minArgs: 2, maxArgs: 3 }) + sendMessage: wrappedSendMessage.bind(null, 'sendMessage', { minArgs: 2, maxArgs: 3 }) } - }; + } const settingMetadata = { clear: { minArgs: 1, maxArgs: 1 }, get: { minArgs: 1, maxArgs: 1 }, set: { minArgs: 1, maxArgs: 1 } - }; + } apiMetadata.privacy = { network: { networkPredictionEnabled: settingMetadata, @@ -1168,20 +1168,20 @@ hyperlinkAuditingEnabled: settingMetadata, referrersEnabled: settingMetadata } - }; + } - return wrapObject(extensionAPIs, staticWrappers, apiMetadata); - }; + return wrapObject(extensionAPIs, staticWrappers, apiMetadata) + } - if (typeof chrome != "object" || !chrome || !chrome.runtime || !chrome.runtime.id) { - throw new Error("This script should only be loaded in a browser extension."); + if (typeof chrome !== 'object' || !chrome || !chrome.runtime || !chrome.runtime.id) { + throw new Error('This script should only be loaded in a browser extension.') } // The build process adds a UMD wrapper around this file, which makes the // `module` variable available. - module.exports = wrapAPIs(chrome); + module.exports = wrapAPIs(chrome) } else { - module.exports = browser; + module.exports = browser } -}); -//# sourceMappingURL=browser-polyfill.js.map +}) +// # sourceMappingURL=browser-polyfill.js.map