bye bye i will do this on another branch
This commit is contained in:
parent
7c76b042f9
commit
354400f33a
17
index.html
17
index.html
|
@ -1,17 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<p>
|
||||
We are using Node.js <span id="node-version"></span>,
|
||||
Chromium <span id="chrome-version"></span>,
|
||||
and Electron <span id="electron-version"></span>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
24
main.js
24
main.js
|
@ -1,24 +0,0 @@
|
|||
const { app, BrowserWindow } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
}
|
||||
})
|
||||
|
||||
win.loadFile('index.html')
|
||||
}
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit()
|
||||
})
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
})
|
|
@ -1 +0,0 @@
|
|||
../electron/cli.js
|
|
@ -1 +0,0 @@
|
|||
../extract-zip/cli.js
|
|
@ -1 +0,0 @@
|
|||
../mkdirp/bin/cmd.js
|
|
@ -1 +0,0 @@
|
|||
../semver/bin/semver.js
|
|
@ -1,905 +0,0 @@
|
|||
{
|
||||
"name": "notertron",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@electron/get": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.14.1.tgz",
|
||||
"integrity": "sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"debug": "^4.1.1",
|
||||
"env-paths": "^2.2.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"got": "^9.6.0",
|
||||
"progress": "^2.0.3",
|
||||
"semver": "^6.2.0",
|
||||
"sumchecker": "^3.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"global-agent": "^3.0.0",
|
||||
"global-tunnel-ng": "^2.7.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@popperjs/core": {
|
||||
"version": "2.11.4",
|
||||
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.4.tgz",
|
||||
"integrity": "sha512-q/ytXxO5NKvyT37pmisQAItCFqA7FD/vNb8dgaJy3/630Fsc+Mz9/9f2SziBoIZ30TJooXyTwZmhi1zjXmObYg==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/popperjs"
|
||||
}
|
||||
},
|
||||
"node_modules/@sindresorhus/is": {
|
||||
"version": "0.14.0",
|
||||
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
|
||||
"integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@szmarczak/http-timer": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz",
|
||||
"integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"defer-to-connect": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "14.18.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.12.tgz",
|
||||
"integrity": "sha512-q4jlIR71hUpWTnGhXWcakgkZeHa3CCjcQcnuzU8M891BAWA2jHiziiWEPEkdS5pFsz7H9HJiy8BrK7tBRNrY7A==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/boolean": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz",
|
||||
"integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/bootstrap": {
|
||||
"version": "5.1.3",
|
||||
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz",
|
||||
"integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/bootstrap"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@popperjs/core": "^2.10.2"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-crc32": {
|
||||
"version": "0.2.13",
|
||||
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
||||
"integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/cacheable-request": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz",
|
||||
"integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"clone-response": "^1.0.2",
|
||||
"get-stream": "^5.1.0",
|
||||
"http-cache-semantics": "^4.0.0",
|
||||
"keyv": "^3.0.0",
|
||||
"lowercase-keys": "^2.0.0",
|
||||
"normalize-url": "^4.1.0",
|
||||
"responselike": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/cacheable-request/node_modules/get-stream": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"pump": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/cacheable-request/node_modules/lowercase-keys": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
|
||||
"integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/clone-response": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz",
|
||||
"integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mimic-response": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-stream": {
|
||||
"version": "1.6.2",
|
||||
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
|
||||
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
|
||||
"dev": true,
|
||||
"engines": [
|
||||
"node >= 0.8"
|
||||
],
|
||||
"dependencies": {
|
||||
"buffer-from": "^1.0.0",
|
||||
"inherits": "^2.0.3",
|
||||
"readable-stream": "^2.2.2",
|
||||
"typedarray": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/config-chain": {
|
||||
"version": "1.1.13",
|
||||
"resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz",
|
||||
"integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"ini": "^1.3.4",
|
||||
"proto-list": "~1.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/core-util-is": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/decompress-response": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
|
||||
"integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mimic-response": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/defer-to-connect": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz",
|
||||
"integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/define-properties": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
||||
"integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"object-keys": "^1.0.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/detect-node": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
|
||||
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/duplexer3": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
|
||||
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/electron": {
|
||||
"version": "17.1.2",
|
||||
"resolved": "https://registry.npmjs.org/electron/-/electron-17.1.2.tgz",
|
||||
"integrity": "sha512-hqKQaUIRWX5Y2eAD8FZINWD/e5TKdpkbBYbkcZmJS4Bd1PKQsaDVc9h5xoA8zZQkPymE9rss+swjRpAFurOPGQ==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@electron/get": "^1.13.0",
|
||||
"@types/node": "^14.6.2",
|
||||
"extract-zip": "^1.0.3"
|
||||
},
|
||||
"bin": {
|
||||
"electron": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.6"
|
||||
}
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
|
||||
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/env-paths": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
|
||||
"integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/es6-error": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
|
||||
"integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/escape-string-regexp": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/extract-zip": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz",
|
||||
"integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"concat-stream": "^1.6.2",
|
||||
"debug": "^2.6.9",
|
||||
"mkdirp": "^0.5.4",
|
||||
"yauzl": "^2.10.0"
|
||||
},
|
||||
"bin": {
|
||||
"extract-zip": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/extract-zip/node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/extract-zip/node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fd-slicer": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
||||
"integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"pend": "~1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fs-extra": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6 <7 || >=8"
|
||||
}
|
||||
},
|
||||
"node_modules/get-stream": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
|
||||
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"pump": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/global-agent": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz",
|
||||
"integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"boolean": "^3.0.1",
|
||||
"es6-error": "^4.1.1",
|
||||
"matcher": "^3.0.0",
|
||||
"roarr": "^2.15.3",
|
||||
"semver": "^7.3.2",
|
||||
"serialize-error": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/global-agent/node_modules/semver": {
|
||||
"version": "7.3.5",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
|
||||
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/global-tunnel-ng": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/global-tunnel-ng/-/global-tunnel-ng-2.7.1.tgz",
|
||||
"integrity": "sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"encodeurl": "^1.0.2",
|
||||
"lodash": "^4.17.10",
|
||||
"npm-conf": "^1.1.3",
|
||||
"tunnel": "^0.0.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/globalthis": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.2.tgz",
|
||||
"integrity": "sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"define-properties": "^1.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/got": {
|
||||
"version": "9.6.0",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
|
||||
"integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@sindresorhus/is": "^0.14.0",
|
||||
"@szmarczak/http-timer": "^1.1.2",
|
||||
"cacheable-request": "^6.0.0",
|
||||
"decompress-response": "^3.3.0",
|
||||
"duplexer3": "^0.1.4",
|
||||
"get-stream": "^4.1.0",
|
||||
"lowercase-keys": "^1.0.1",
|
||||
"mimic-response": "^1.0.1",
|
||||
"p-cancelable": "^1.0.0",
|
||||
"to-readable-stream": "^1.0.0",
|
||||
"url-parse-lax": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
}
|
||||
},
|
||||
"node_modules/graceful-fs": {
|
||||
"version": "4.2.9",
|
||||
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz",
|
||||
"integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/http-cache-semantics": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
|
||||
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ini": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/json-buffer": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz",
|
||||
"integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/json-stringify-safe": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
|
||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/jsonfile": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
|
||||
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
|
||||
"dev": true,
|
||||
"optionalDependencies": {
|
||||
"graceful-fs": "^4.1.6"
|
||||
}
|
||||
},
|
||||
"node_modules/keyv": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
|
||||
"integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"json-buffer": "3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/lowercase-keys": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
|
||||
"integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/matcher": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz",
|
||||
"integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/mimic-response": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
|
||||
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
"version": "0.5.5",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
|
||||
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.5"
|
||||
},
|
||||
"bin": {
|
||||
"mkdirp": "bin/cmd.js"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/normalize-url": {
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz",
|
||||
"integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/npm-conf": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz",
|
||||
"integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"config-chain": "^1.1.11",
|
||||
"pify": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/object-keys": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
|
||||
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/p-cancelable": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
|
||||
"integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/pend": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/pify": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
||||
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/prepend-http": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
|
||||
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/progress": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/proto-list": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
|
||||
"integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/pump": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/responselike": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz",
|
||||
"integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"lowercase-keys": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/roarr": {
|
||||
"version": "2.15.4",
|
||||
"resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz",
|
||||
"integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"boolean": "^3.0.1",
|
||||
"detect-node": "^2.0.4",
|
||||
"globalthis": "^1.0.1",
|
||||
"json-stringify-safe": "^5.0.1",
|
||||
"semver-compare": "^1.0.0",
|
||||
"sprintf-js": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/semver-compare": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",
|
||||
"integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/serialize-error": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz",
|
||||
"integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"type-fest": "^0.13.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz",
|
||||
"integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sumchecker": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz",
|
||||
"integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"debug": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/to-readable-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tunnel": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||
}
|
||||
},
|
||||
"node_modules/type-fest": {
|
||||
"version": "0.13.1",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
|
||||
"integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/typedarray": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
||||
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/universalify": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
|
||||
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/url-parse-lax": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
|
||||
"integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"prepend-http": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/yauzl": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||
"integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"buffer-crc32": "~0.2.3",
|
||||
"fd-slicer": "~1.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Contributors to the Electron project
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,142 +0,0 @@
|
|||
# @electron/get
|
||||
|
||||
> Download Electron release artifacts
|
||||
|
||||
[![CircleCI](https://circleci.com/gh/electron/get.svg?style=svg)](https://circleci.com/gh/electron/get)
|
||||
|
||||
## Usage
|
||||
|
||||
### Simple: Downloading an Electron Binary ZIP
|
||||
|
||||
```typescript
|
||||
import { download } from '@electron/get';
|
||||
|
||||
// NB: Use this syntax within an async function, Node does not have support for
|
||||
// top-level await as of Node 12.
|
||||
const zipFilePath = await download('4.0.4');
|
||||
```
|
||||
|
||||
### Advanced: Downloading a macOS Electron Symbol File
|
||||
|
||||
|
||||
```typescript
|
||||
import { downloadArtifact } from '@electron/get';
|
||||
|
||||
// NB: Use this syntax within an async function, Node does not have support for
|
||||
// top-level await as of Node 12.
|
||||
const zipFilePath = await downloadArtifact({
|
||||
version: '4.0.4',
|
||||
platform: 'darwin',
|
||||
artifactName: 'electron',
|
||||
artifactSuffix: 'symbols',
|
||||
arch: 'x64',
|
||||
});
|
||||
```
|
||||
|
||||
### Specifying a mirror
|
||||
|
||||
To specify another location to download Electron assets from, the following options are
|
||||
available:
|
||||
|
||||
* `mirrorOptions` Object
|
||||
* `mirror` String (optional) - The base URL of the mirror to download from.
|
||||
* `nightlyMirror` String (optional) - The Electron nightly-specific mirror URL.
|
||||
* `customDir` String (optional) - The name of the directory to download from, often scoped by version number.
|
||||
* `customFilename` String (optional) - The name of the asset to download.
|
||||
* `resolveAssetURL` Function (optional) - A function allowing customization of the url used to download the asset.
|
||||
|
||||
Anatomy of a download URL, in terms of `mirrorOptions`:
|
||||
|
||||
```
|
||||
https://github.com/electron/electron/releases/download/v4.0.4/electron-v4.0.4-linux-x64.zip
|
||||
| | | |
|
||||
------------------------------------------------------- -----------------------------
|
||||
| |
|
||||
mirror / nightlyMirror | | customFilename
|
||||
------
|
||||
||
|
||||
customDir
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
import { download } from '@electron/get';
|
||||
|
||||
const zipFilePath = await download('4.0.4', {
|
||||
mirrorOptions: {
|
||||
mirror: 'https://mirror.example.com/electron/',
|
||||
customDir: 'custom',
|
||||
customFilename: 'unofficial-electron-linux.zip'
|
||||
}
|
||||
});
|
||||
// Will download from https://mirror.example.com/electron/custom/unofficial-electron-linux.zip
|
||||
|
||||
const nightlyZipFilePath = await download('8.0.0-nightly.20190901', {
|
||||
mirrorOptions: {
|
||||
nightlyMirror: 'https://nightly.example.com/',
|
||||
customDir: 'nightlies',
|
||||
customFilename: 'nightly-linux.zip'
|
||||
}
|
||||
});
|
||||
// Will download from https://nightly.example.com/nightlies/nightly-linux.zip
|
||||
```
|
||||
|
||||
`customDir` can have the placeholder `{{ version }}`, which will be replaced by the version
|
||||
specified (without the leading `v`). For example:
|
||||
|
||||
```javascript
|
||||
const zipFilePath = await download('4.0.4', {
|
||||
mirrorOptions: {
|
||||
mirror: 'https://mirror.example.com/electron/',
|
||||
customDir: 'version-{{ version }}',
|
||||
platform: 'linux',
|
||||
arch: 'x64'
|
||||
}
|
||||
});
|
||||
// Will download from https://mirror.example.com/electron/version-4.0.4/electron-v4.0.4-linux-x64.zip
|
||||
```
|
||||
|
||||
#### Using environment variables for mirror options
|
||||
Mirror options can also be specified via the following environment variables:
|
||||
* `ELECTRON_CUSTOM_DIR` - Specifies the custom directory to download from.
|
||||
* `ELECTRON_CUSTOM_FILENAME` - Specifies the custom file name to download.
|
||||
* `ELECTRON_MIRROR` - Specifies the URL of the server to download from if the version is not a nightly version.
|
||||
* `ELECTRON_NIGHTLY_MIRROR` - Specifies the URL of the server to download from if the version is a nightly version.
|
||||
|
||||
### Overriding the version downloaded
|
||||
|
||||
The version downloaded can be overriden by setting the `ELECTRON_CUSTOM_VERSION` environment variable.
|
||||
Setting this environment variable will override the version passed in to `download` or `downloadArtifact`.
|
||||
|
||||
## How It Works
|
||||
|
||||
This module downloads Electron to a known place on your system and caches it
|
||||
so that future requests for that asset can be returned instantly. The cache
|
||||
locations are:
|
||||
|
||||
* Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
|
||||
* MacOS: `~/Library/Caches/electron/`
|
||||
* Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
|
||||
|
||||
By default, the module uses [`got`](https://github.com/sindresorhus/got) as the
|
||||
downloader. As a result, you can use the same [options](https://github.com/sindresorhus/got#options)
|
||||
via `downloadOptions`.
|
||||
|
||||
### Progress Bar
|
||||
|
||||
By default, a progress bar is shown when downloading an artifact for more than 30 seconds. To
|
||||
disable, set the `ELECTRON_GET_NO_PROGRESS` environment variable to any non-empty value, or set
|
||||
`quiet` to `true` in `downloadOptions`. If you need to monitor progress yourself via the API, set
|
||||
`getProgressCallback` in `downloadOptions`, which has the same function signature as `got`'s
|
||||
[`downloadProgress` event callback](https://github.com/sindresorhus/got#ondownloadprogress-progress).
|
||||
|
||||
### Proxies
|
||||
|
||||
Downstream packages should utilize the `initializeProxy` function to add HTTP(S) proxy support. If
|
||||
the environment variable `ELECTRON_GET_USE_PROXY` is set, it is called automatically. A different
|
||||
proxy module is used, depending on the version of Node in use, and as such, there are slightly
|
||||
different ways to set the proxy environment variables. For Node 10 and above,
|
||||
[`global-agent`](https://github.com/gajus/global-agent#environment-variables) is used. Otherwise,
|
||||
[`global-tunnel-ng`](https://github.com/np-maintain/global-tunnel#auto-config) is used. Refer to the
|
||||
appropriate linked module to determine how to configure proxy support.
|
|
@ -1,8 +0,0 @@
|
|||
export declare class Cache {
|
||||
private cacheRoot;
|
||||
constructor(cacheRoot?: string);
|
||||
static getCacheDirectory(downloadUrl: string): string;
|
||||
getCachePath(downloadUrl: string, fileName: string): string;
|
||||
getPathForFileInCache(url: string, fileName: string): Promise<string | null>;
|
||||
putFileInCache(url: string, currentPath: string, fileName: string): Promise<string>;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
"use strict";
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const debug_1 = require("debug");
|
||||
const env_paths_1 = require("env-paths");
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
const url = require("url");
|
||||
const crypto = require("crypto");
|
||||
const d = debug_1.default('@electron/get:cache');
|
||||
const defaultCacheRoot = env_paths_1.default('electron', {
|
||||
suffix: '',
|
||||
}).cache;
|
||||
class Cache {
|
||||
constructor(cacheRoot = defaultCacheRoot) {
|
||||
this.cacheRoot = cacheRoot;
|
||||
}
|
||||
static getCacheDirectory(downloadUrl) {
|
||||
const parsedDownloadUrl = url.parse(downloadUrl);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { search, hash, pathname } = parsedDownloadUrl, rest = __rest(parsedDownloadUrl, ["search", "hash", "pathname"]);
|
||||
const strippedUrl = url.format(Object.assign(Object.assign({}, rest), { pathname: path.dirname(pathname || 'electron') }));
|
||||
return crypto
|
||||
.createHash('sha256')
|
||||
.update(strippedUrl)
|
||||
.digest('hex');
|
||||
}
|
||||
getCachePath(downloadUrl, fileName) {
|
||||
return path.resolve(this.cacheRoot, Cache.getCacheDirectory(downloadUrl), fileName);
|
||||
}
|
||||
async getPathForFileInCache(url, fileName) {
|
||||
const cachePath = this.getCachePath(url, fileName);
|
||||
if (await fs.pathExists(cachePath)) {
|
||||
return cachePath;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
async putFileInCache(url, currentPath, fileName) {
|
||||
const cachePath = this.getCachePath(url, fileName);
|
||||
d(`Moving ${currentPath} to ${cachePath}`);
|
||||
if (await fs.pathExists(cachePath)) {
|
||||
d('* Replacing existing file');
|
||||
await fs.remove(cachePath);
|
||||
}
|
||||
await fs.move(currentPath, cachePath);
|
||||
return cachePath;
|
||||
}
|
||||
}
|
||||
exports.Cache = Cache;
|
||||
//# sourceMappingURL=Cache.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../src/Cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iCAA0B;AAC1B,yCAAiC;AACjC,+BAA+B;AAC/B,6BAA6B;AAC7B,2BAA2B;AAC3B,iCAAiC;AAEjC,MAAM,CAAC,GAAG,eAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC,MAAM,gBAAgB,GAAG,mBAAQ,CAAC,UAAU,EAAE;IAC5C,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,KAAK,CAAC;AAET,MAAa,KAAK;IAChB,YAAoB,YAAY,gBAAgB;Q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2BAA2B,CAAC,CAAC;YAC/B,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SAC5B;QAED,MAAM,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAEtC,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAxCD,sBAwCC"}
|
|
@ -1,3 +0,0 @@
|
|||
export interface Downloader<T> {
|
||||
download(url: string, targetFilePath: string, options: T): Promise<void>;
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=Downloader.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"Downloader.js","sourceRoot":"","sources":["../../src/Downloader.ts"],"names":[],"mappings":""}
|
|
@ -1,19 +0,0 @@
|
|||
import * as got from 'got';
|
||||
import { Downloader } from './Downloader';
|
||||
/**
|
||||
* See [`got#options`](https://github.com/sindresorhus/got#options) for possible keys/values.
|
||||
*/
|
||||
export declare type GotDownloaderOptions = got.GotOptions<string | null> & {
|
||||
/**
|
||||
* if defined, triggers every time `got`'s `downloadProgress` event callback is triggered.
|
||||
*/
|
||||
getProgressCallback?: (progress: got.Progress) => Promise<void>;
|
||||
/**
|
||||
* if `true`, disables the console progress bar (setting the `ELECTRON_GET_NO_PROGRESS`
|
||||
* environment variable to a non-empty value also does this).
|
||||
*/
|
||||
quiet?: boolean;
|
||||
};
|
||||
export declare class GotDownloader implements Downloader<GotDownloaderOptions> {
|
||||
download(url: string, targetFilePath: string, options?: GotDownloaderOptions): Promise<void>;
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
"use strict";
|
||||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = require("fs-extra");
|
||||
const got = require("got");
|
||||
const path = require("path");
|
||||
const ProgressBar = require("progress");
|
||||
const PROGRESS_BAR_DELAY_IN_SECONDS = 30;
|
||||
class GotDownloader {
|
||||
async download(url, targetFilePath, options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
const { quiet, getProgressCallback } = options, gotOptions = __rest(options, ["quiet", "getProgressCallback"]);
|
||||
let downloadCompleted = false;
|
||||
let bar;
|
||||
let progressPercent;
|
||||
let timeout = undefined;
|
||||
await fs.mkdirp(path.dirname(targetFilePath));
|
||||
const writeStream = fs.createWriteStream(targetFilePath);
|
||||
if (!quiet || !process.env.ELECTRON_GET_NO_PROGRESS) {
|
||||
const start = new Date();
|
||||
timeout = setTimeout(() => {
|
||||
if (!downloadCompleted) {
|
||||
bar = new ProgressBar(`Downloading ${path.basename(url)}: [:bar] :percent ETA: :eta seconds `, {
|
||||
curr: progressPercent,
|
||||
total: 100,
|
||||
});
|
||||
// https://github.com/visionmedia/node-progress/issues/159
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
bar.start = start;
|
||||
}
|
||||
}, PROGRESS_BAR_DELAY_IN_SECONDS * 1000);
|
||||
}
|
||||
await new Promise((resolve, reject) => {
|
||||
const downloadStream = got.stream(url, gotOptions);
|
||||
downloadStream.on('downloadProgress', async (progress) => {
|
||||
progressPercent = progress.percent;
|
||||
if (bar) {
|
||||
bar.update(progress.percent);
|
||||
}
|
||||
if (getProgressCallback) {
|
||||
await getProgressCallback(progress);
|
||||
}
|
||||
});
|
||||
downloadStream.on('error', error => {
|
||||
if (error.name === 'HTTPError' && error.statusCode === 404) {
|
||||
error.message += ` for ${error.url}`;
|
||||
}
|
||||
if (writeStream.destroy) {
|
||||
writeStream.destroy(error);
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
writeStream.on('error', error => reject(error));
|
||||
writeStream.on('close', () => resolve());
|
||||
downloadStream.pipe(writeStream);
|
||||
});
|
||||
downloadCompleted = true;
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.GotDownloader = GotDownloader;
|
||||
//# sourceMappingURL=GotDownloader.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"GotDownloader.js","sourceRoot":"","sources":["../../src/GotDownloader.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,2BAA2B;AAC3B,6BAA6B;AAC7B,wCAAwC;AAIxC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAiBzC,MAAa,aAAa;IACxB,KAAK,CAAC,QAAQ,CACZ,GAAW,EACX,cAAsB,EACtB,OAA8B;QAE9B,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,EAAE,KAAK,EAAE,mBAAmB,KAAoB,OAAO,EAAzB,8DAAyB,CAAC;QAC9D,IAAI,iBAAiB,GAAG,KAAK,CAAC;QAC9B,IAAI,GAA4B,CAAC;QACjC,IAAI,eAAuB,CAAC;QAC5B,IAAI,OAAO,GAA+B,SAAS,CAAC;QACpD,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;QAC9C,MAAM,WAAW,GAAG,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;QAEzD,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE;YACnD,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;YACzB,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBACxB,IAAI,CAAC,iBAAiB,EAAE;oBACtB,GAAG,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,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAEzC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,iBAAiB,GAAG,IAAI,CAAC;QACzB,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;IACH,CAAC;CACF;AAlED,sCAkEC"}
|
|
@ -1,3 +0,0 @@
|
|||
import { ElectronArtifactDetails } from './types';
|
||||
export declare function getArtifactFileName(details: ElectronArtifactDetails): string;
|
||||
export declare function getArtifactRemoteURL(details: ElectronArtifactDetails): Promise<string>;
|
|
@ -1,56 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("./utils");
|
||||
const BASE_URL = 'https://github.com/electron/electron/releases/download/';
|
||||
const NIGHTLY_BASE_URL = 'https://github.com/electron/nightlies/releases/download/';
|
||||
function getArtifactFileName(details) {
|
||||
utils_1.ensureIsTruthyString(details, 'artifactName');
|
||||
if (details.isGeneric) {
|
||||
return details.artifactName;
|
||||
}
|
||||
utils_1.ensureIsTruthyString(details, 'arch');
|
||||
utils_1.ensureIsTruthyString(details, 'platform');
|
||||
utils_1.ensureIsTruthyString(details, 'version');
|
||||
return `${[
|
||||
details.artifactName,
|
||||
details.version,
|
||||
details.platform,
|
||||
details.arch,
|
||||
...(details.artifactSuffix ? [details.artifactSuffix] : []),
|
||||
].join('-')}.zip`;
|
||||
}
|
||||
exports.getArtifactFileName = getArtifactFileName;
|
||||
function mirrorVar(name, options, defaultValue) {
|
||||
// Convert camelCase to camel_case for env var reading
|
||||
const lowerName = name.replace(/([a-z])([A-Z])/g, (_, a, b) => `${a}_${b}`).toLowerCase();
|
||||
return (process.env[`NPM_CONFIG_ELECTRON_${lowerName.toUpperCase()}`] ||
|
||||
process.env[`npm_config_electron_${lowerName}`] ||
|
||||
process.env[`npm_package_config_electron_${lowerName}`] ||
|
||||
process.env[`ELECTRON_${lowerName.toUpperCase()}`] ||
|
||||
options[name] ||
|
||||
defaultValue);
|
||||
}
|
||||
async function getArtifactRemoteURL(details) {
|
||||
const opts = details.mirrorOptions || {};
|
||||
let base = mirrorVar('mirror', opts, BASE_URL);
|
||||
if (details.version.includes('nightly')) {
|
||||
const nightlyDeprecated = mirrorVar('nightly_mirror', opts, '');
|
||||
if (nightlyDeprecated) {
|
||||
base = nightlyDeprecated;
|
||||
console.warn(`nightly_mirror is deprecated, please use nightlyMirror`);
|
||||
}
|
||||
else {
|
||||
base = mirrorVar('nightlyMirror', opts, NIGHTLY_BASE_URL);
|
||||
}
|
||||
}
|
||||
const path = mirrorVar('customDir', opts, details.version).replace('{{ version }}', details.version.replace(/^v/, ''));
|
||||
const file = mirrorVar('customFilename', opts, getArtifactFileName(details));
|
||||
// Allow customized download URL resolution.
|
||||
if (opts.resolveAssetURL) {
|
||||
const url = await opts.resolveAssetURL(details);
|
||||
return url;
|
||||
}
|
||||
return `${base}${path}/${file}`;
|
||||
}
|
||||
exports.getArtifactRemoteURL = getArtifactRemoteURL;
|
||||
//# sourceMappingURL=artifact-utils.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"artifact-utils.js","sourceRoot":"","sources":["../../src/artifact-utils.ts"],"names":[],"mappings":";;AACA,mCAA+C;AAE/C,MAAM,QAAQ,GAAG,yDAAyD,CAAC;AAC3E,MAAM,gBAAgB,GAAG,0DAA0D,CAAC;AAEpF,SAAgB,mBAAmB,CAAC,OAAgC;IAClE,4BAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAE9C,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,OAAO,OAAO,CAAC,YAAY,CAAC;KAC7B;IAED,4BAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACtC,4BAAoB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1C,4BAAoB,CAAC,OAAO,EAAE,S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AAC,CAAC;QAChE,IAAI,iBAAiB,EAAE;YACrB,IAAI,GAAG,iBAAiB,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;SACxE;aAAM;YACL,IAAI,GAAG,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;SAC3D;KACF;IACD,MAAM,IAAI,GAAG,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAChE,eAAe,EACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAClC,CAAC;IACF,MAAM,IAAI,GAAG,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;IAE7E,4CAA4C;IAC5C,IAAI,IAAI,CAAC,eAAe,EAAE;QACxB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,GAAG,CAAC;KACZ;IAED,OAAO,GAAG,IAAI,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;AAClC,CAAC;AAzBD,oDAyBC"}
|
|
@ -1,3 +0,0 @@
|
|||
import { DownloadOptions } from './types';
|
||||
import { Downloader } from './Downloader';
|
||||
export declare function getDownloaderForSystem(): Promise<Downloader<DownloadOptions>>;
|
|
@ -1,12 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
async function getDownloaderForSystem() {
|
||||
// TODO: Resolve the downloader or default to GotDownloader
|
||||
// Current thoughts are a dot-file traversal for something like
|
||||
// ".electron.downloader" which would be a text file with the name of the
|
||||
// npm module to import() and use as the downloader
|
||||
const { GotDownloader } = await Promise.resolve().then(() => require('./GotDownloader'));
|
||||
return new GotDownloader();
|
||||
}
|
||||
exports.getDownloaderForSystem = getDownloaderForSystem;
|
||||
//# sourceMappingURL=downloader-resolver.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"downloader-resolver.js","sourceRoot":"","sources":["../../src/downloader-resolver.ts"],"names":[],"mappings":";;AAGO,KAAK,UAAU,sBAAsB;IAC1C,2DAA2D;IAC3D,+DAA+D;IAC/D,yEAAyE;IACzE,mDAAmD;IACnD,MAAM,EAAE,aAAa,EAAE,GAAG,2CAAa,iBAAiB,EAAC,CAAC;IAC1D,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC;AAPD,wDAOC"}
|
|
@ -1,18 +0,0 @@
|
|||
import { ElectronDownloadRequestOptions, ElectronPlatformArtifactDetailsWithDefaults } from './types';
|
||||
export { getHostArch } from './utils';
|
||||
export { initializeProxy } from './proxy';
|
||||
export * from './types';
|
||||
/**
|
||||
* Downloads an artifact from an Electron release and returns an absolute path
|
||||
* to the downloaded file.
|
||||
*
|
||||
* @param artifactDetails - The information required to download the artifact
|
||||
*/
|
||||
export declare function downloadArtifact(_artifactDetails: ElectronPlatformArtifactDetailsWithDefaults): Promise<string>;
|
||||
/**
|
||||
* Downloads a specific version of Electron and returns an absolute path to a
|
||||
* ZIP file.
|
||||
*
|
||||
* @param version - The version of Electron you want to download
|
||||
*/
|
||||
export declare function download(version: string, options?: ElectronDownloadRequestOptions): Promise<string>;
|
|
@ -1,130 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const debug_1 = require("debug");
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
const semver = require("semver");
|
||||
const sumchecker = require("sumchecker");
|
||||
const artifact_utils_1 = require("./artifact-utils");
|
||||
const Cache_1 = require("./Cache");
|
||||
const downloader_resolver_1 = require("./downloader-resolver");
|
||||
const proxy_1 = require("./proxy");
|
||||
const utils_1 = require("./utils");
|
||||
var utils_2 = require("./utils");
|
||||
exports.getHostArch = utils_2.getHostArch;
|
||||
var proxy_2 = require("./proxy");
|
||||
exports.initializeProxy = proxy_2.initializeProxy;
|
||||
const d = debug_1.default('@electron/get:index');
|
||||
if (process.env.ELECTRON_GET_USE_PROXY) {
|
||||
proxy_1.initializeProxy();
|
||||
}
|
||||
/**
|
||||
* Downloads an artifact from an Electron release and returns an absolute path
|
||||
* to the downloaded file.
|
||||
*
|
||||
* @param artifactDetails - The information required to download the artifact
|
||||
*/
|
||||
async function downloadArtifact(_artifactDetails) {
|
||||
const artifactDetails = Object.assign({}, _artifactDetails);
|
||||
if (!_artifactDetails.isGeneric) {
|
||||
const platformArtifactDetails = artifactDetails;
|
||||
if (!platformArtifactDetails.platform) {
|
||||
d('No platform found, defaulting to the host platform');
|
||||
platformArtifactDetails.platform = process.platform;
|
||||
}
|
||||
if (platformArtifactDetails.arch) {
|
||||
platformArtifactDetails.arch = utils_1.getNodeArch(platformArtifactDetails.arch);
|
||||
}
|
||||
else {
|
||||
d('No arch found, defaulting to the host arch');
|
||||
platformArtifactDetails.arch = utils_1.getHostArch();
|
||||
}
|
||||
}
|
||||
utils_1.ensureIsTruthyString(artifactDetails, 'version');
|
||||
artifactDetails.version = utils_1.normalizeVersion(process.env.ELECTRON_CUSTOM_VERSION || artifactDetails.version);
|
||||
const fileName = artifact_utils_1.getArtifactFileName(artifactDetails);
|
||||
const url = await artifact_utils_1.getArtifactRemoteURL(artifactDetails);
|
||||
const cache = new Cache_1.Cache(artifactDetails.cacheRoot);
|
||||
// Do not check if the file exists in the cache when force === true
|
||||
if (!artifactDetails.force) {
|
||||
d(`Checking the cache (${artifactDetails.cacheRoot}) for ${fileName} (${url})`);
|
||||
const cachedPath = await cache.getPathForFileInCache(url, fileName);
|
||||
if (cachedPath === null) {
|
||||
d('Cache miss');
|
||||
}
|
||||
else {
|
||||
d('Cache hit');
|
||||
return cachedPath;
|
||||
}
|
||||
}
|
||||
if (!artifactDetails.isGeneric &&
|
||||
utils_1.isOfficialLinuxIA32Download(artifactDetails.platform, artifactDetails.arch, artifactDetails.version, artifactDetails.mirrorOptions)) {
|
||||
console.warn('Official Linux/ia32 support is deprecated.');
|
||||
console.warn('For more info: https://electronjs.org/blog/linux-32bit-support');
|
||||
}
|
||||
return await utils_1.withTempDirectoryIn(artifactDetails.tempDirectory, async (tempFolder) => {
|
||||
const tempDownloadPath = path.resolve(tempFolder, artifact_utils_1.getArtifactFileName(artifactDetails));
|
||||
const downloader = artifactDetails.downloader || (await downloader_resolver_1.getDownloaderForSystem());
|
||||
d(`Downloading ${url} to ${tempDownloadPath} with options: ${JSON.stringify(artifactDetails.downloadOptions)}`);
|
||||
await downloader.download(url, tempDownloadPath, artifactDetails.downloadOptions);
|
||||
// Don't try to verify the hash of the hash file itself
|
||||
// and for older versions that don't have a SHASUMS256.txt
|
||||
if (!artifactDetails.artifactName.startsWith('SHASUMS256') &&
|
||||
!artifactDetails.unsafelyDisableChecksums &&
|
||||
semver.gte(artifactDetails.version, '1.3.2')) {
|
||||
await utils_1.withTempDirectory(async (tmpDir) => {
|
||||
let shasumPath;
|
||||
const checksums = artifactDetails.checksums;
|
||||
if (checksums) {
|
||||
shasumPath = path.resolve(tmpDir, 'SHASUMS256.txt');
|
||||
const fileNames = Object.keys(checksums);
|
||||
if (fileNames.length === 0) {
|
||||
throw new Error('Provided "checksums" object is empty, cannot generate a valid SHASUMS256.txt');
|
||||
}
|
||||
const generatedChecksums = fileNames
|
||||
.map(fileName => `${checksums[fileName]} *${fileName}`)
|
||||
.join('\n');
|
||||
await fs.writeFile(shasumPath, generatedChecksums);
|
||||
}
|
||||
else {
|
||||
shasumPath = await downloadArtifact({
|
||||
isGeneric: true,
|
||||
version: artifactDetails.version,
|
||||
artifactName: 'SHASUMS256.txt',
|
||||
force: artifactDetails.force,
|
||||
downloadOptions: artifactDetails.downloadOptions,
|
||||
cacheRoot: artifactDetails.cacheRoot,
|
||||
downloader: artifactDetails.downloader,
|
||||
mirrorOptions: artifactDetails.mirrorOptions,
|
||||
});
|
||||
}
|
||||
// For versions 1.3.2 - 1.3.4, need to overwrite the `defaultTextEncoding` option:
|
||||
// https://github.com/electron/electron/pull/6676#discussion_r75332120
|
||||
if (semver.satisfies(artifactDetails.version, '1.3.2 - 1.3.4')) {
|
||||
const validatorOptions = {};
|
||||
validatorOptions.defaultTextEncoding = 'binary';
|
||||
const checker = new sumchecker.ChecksumValidator('sha256', shasumPath, validatorOptions);
|
||||
await checker.validate(path.dirname(tempDownloadPath), path.basename(tempDownloadPath));
|
||||
}
|
||||
else {
|
||||
await sumchecker('sha256', shasumPath, path.dirname(tempDownloadPath), [
|
||||
path.basename(tempDownloadPath),
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
return await cache.putFileInCache(url, tempDownloadPath, fileName);
|
||||
});
|
||||
}
|
||||
exports.downloadArtifact = downloadArtifact;
|
||||
/**
|
||||
* Downloads a specific version of Electron and returns an absolute path to a
|
||||
* ZIP file.
|
||||
*
|
||||
* @param version - The version of Electron you want to download
|
||||
*/
|
||||
function download(version, options) {
|
||||
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' }));
|
||||
}
|
||||
exports.download = download;
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;AAAA,iCAA0B;AAC1B,+BAA+B;AAC/B,6BAA6B;AAC7B,iCAAiC;AACjC,yCAAyC;AAEzC,qDAA6E;AAO7E,mCAAgC;AAChC,+DAA+D;AAC/D,mCAA0C;AAC1C,mCAQiB;AAEjB,iCAAsC;AAA7B,8BAAA,WAAW,CAAA;AACpB,iCAA0C;AAAjC,kCAAA,eAAe,CAAA;AAGxB,MAAM,CAAC,GAAG,eAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE;IACtC,uBAAe,EAAE,CAAC;CACnB;AAED;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CACpC,gBAA6D;IAE7D,MAAM,eAAe,qBACf,gBAA4C,CACjD,CA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BAAgB,CAAC,EAAE;wBACrE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;qBAChC,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,MAAM,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACL,CAAC;AArHD,4CAqHC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CACtB,OAAe,EACf,OAAwC;IAExC,OAAO,gBAAgB,iCAClB,OAAO,KACV,OAAO,EACP,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAC1B,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,YAAY,EAAE,UAAU,IACxB,CAAC;AACL,CAAC;AAXD,4BAWC"}
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* Initializes a third-party proxy module for HTTP(S) requests.
|
||||
*/
|
||||
export declare function initializeProxy(): void;
|
|
@ -1,32 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const debug = require("debug");
|
||||
const utils_1 = require("./utils");
|
||||
const d = debug('@electron/get:proxy');
|
||||
/**
|
||||
* Initializes a third-party proxy module for HTTP(S) requests.
|
||||
*/
|
||||
function initializeProxy() {
|
||||
try {
|
||||
// Code originally from https://github.com/yeoman/yo/blob/b2eea87e/lib/cli.js#L19-L28
|
||||
const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);
|
||||
if (MAJOR_NODEJS_VERSION >= 10) {
|
||||
// See: https://github.com/electron/get/pull/214#discussion_r798845713
|
||||
const env = utils_1.getEnv('GLOBAL_AGENT_');
|
||||
utils_1.setEnv('GLOBAL_AGENT_HTTP_PROXY', env('HTTP_PROXY'));
|
||||
utils_1.setEnv('GLOBAL_AGENT_HTTPS_PROXY', env('HTTPS_PROXY'));
|
||||
utils_1.setEnv('GLOBAL_AGENT_NO_PROXY', env('NO_PROXY'));
|
||||
// `global-agent` works with Node.js v10 and above.
|
||||
require('global-agent').bootstrap();
|
||||
}
|
||||
else {
|
||||
// `global-tunnel-ng` works with Node.js v10 and below.
|
||||
require('global-tunnel-ng').initialize();
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
d('Could not load either proxy modules, built-in proxy support not available:', e);
|
||||
}
|
||||
}
|
||||
exports.initializeProxy = initializeProxy;
|
||||
//# sourceMappingURL=proxy.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/proxy.ts"],"names":[],"mappings":";;AAAA,+BAA+B;AAC/B,mCAAyC;AAEzC,MAAM,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC;;GAEG;AACH,SAAgB,eAAe;IAC7B,IAAI;QACF,qFAAqF;QACrF,MAAM,oBAAoB,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAElF,IAAI,oBAAoB,IAAI,EAAE,EAAE;YAC9B,sEAAsE;YACtE,MAAM,GAAG,GAAG,cAAM,CAAC,eAAe,CAAC,CAAC;YAEpC,cAAM,CAAC,yBAAyB,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;YACrD,cAAM,CAAC,0BAA0B,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YACvD,cAAM,CAAC,uBAAuB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;YAEjD,mDAAmD;YACnD,OAAO,CAAC,cAAc,CAAC,CAAC,SAAS,EAAE,CAAC;SACrC;aAAM;YACL,uDAAuD;YACvD,OAAO,CAAC,kBAAkB,CAAC,CAAC,UAAU,EAAE,CAAC;SAC1C;KACF;IAAC,OAAO,CAAC,EAAE;QACV,CAAC,CAAC,4EAA4E,EAAE,CAAC,CAAC,CAAC;KACpF;AACH,CAAC;AAtBD,0CAsBC"}
|
|
@ -1,124 +0,0 @@
|
|||
import { Downloader } from './Downloader';
|
||||
export declare type DownloadOptions = any;
|
||||
export interface MirrorOptions {
|
||||
/**
|
||||
* DEPRECATED - see nightlyMirror.
|
||||
*/
|
||||
nightly_mirror?: string;
|
||||
/**
|
||||
* The Electron nightly-specific mirror URL.
|
||||
*/
|
||||
nightlyMirror?: string;
|
||||
/**
|
||||
* The base URL of the mirror to download from,
|
||||
* e.g https://github.com/electron/electron/releases/download
|
||||
*/
|
||||
mirror?: string;
|
||||
/**
|
||||
* The name of the directory to download from,
|
||||
* often scoped by version number e.g 'v4.0.4'
|
||||
*/
|
||||
customDir?: string;
|
||||
/**
|
||||
* The name of the asset to download,
|
||||
* e.g 'electron-v4.0.4-linux-x64.zip'
|
||||
*/
|
||||
customFilename?: string;
|
||||
/**
|
||||
* A function allowing customization of the url returned
|
||||
* from getArtifactRemoteURL().
|
||||
*/
|
||||
resolveAssetURL?: (opts: DownloadOptions) => Promise<string>;
|
||||
}
|
||||
export interface ElectronDownloadRequest {
|
||||
/**
|
||||
* The version of Electron associated with the artifact.
|
||||
*/
|
||||
version: string;
|
||||
/**
|
||||
* The type of artifact. For example:
|
||||
* * `electron`
|
||||
* * `ffmpeg`
|
||||
*/
|
||||
artifactName: string;
|
||||
}
|
||||
export interface ElectronDownloadRequestOptions {
|
||||
/**
|
||||
* Whether to download an artifact regardless of whether it's in the cache directory.
|
||||
*
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
force?: boolean;
|
||||
/**
|
||||
* When set to `true`, disables checking that the artifact download completed successfully
|
||||
* with the correct payload.
|
||||
*
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
unsafelyDisableChecksums?: boolean;
|
||||
/**
|
||||
* Provides checksums for the artifact as strings.
|
||||
* Can be used if you already know the checksums of the Electron artifact
|
||||
* you are downloading and want to skip the checksum file download
|
||||
* without skipping the checksum validation.
|
||||
*
|
||||
* This should be an object whose keys are the file names of the artifacts and
|
||||
* the values are their respective SHA256 checksums.
|
||||
*/
|
||||
checksums?: Record<string, string>;
|
||||
/**
|
||||
* The directory that caches Electron artifact downloads.
|
||||
*
|
||||
* The default value is dependent upon the host platform:
|
||||
*
|
||||
* * Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
|
||||
* * MacOS: `~/Library/Caches/electron/`
|
||||
* * Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
|
||||
*/
|
||||
cacheRoot?: string;
|
||||
/**
|
||||
* Options passed to the downloader module.
|
||||
*/
|
||||
downloadOptions?: DownloadOptions;
|
||||
/**
|
||||
* Options related to specifying an artifact mirror.
|
||||
*/
|
||||
mirrorOptions?: MirrorOptions;
|
||||
/**
|
||||
* The custom [[Downloader]] class used to download artifacts. Defaults to the
|
||||
* built-in [[GotDownloader]].
|
||||
*/
|
||||
downloader?: Downloader<DownloadOptions>;
|
||||
/**
|
||||
* A temporary directory for downloads.
|
||||
* It is used before artifacts are put into cache.
|
||||
*/
|
||||
tempDirectory?: string;
|
||||
}
|
||||
export declare type ElectronPlatformArtifactDetails = {
|
||||
/**
|
||||
* The target artifact platform. These are Node-style platform names, for example:
|
||||
* * `win32`
|
||||
* * `darwin`
|
||||
* * `linux`
|
||||
*/
|
||||
platform: string;
|
||||
/**
|
||||
* The target artifact architecture. These are Node-style architecture names, for example:
|
||||
* * `ia32`
|
||||
* * `x64`
|
||||
* * `armv7l`
|
||||
*/
|
||||
arch: string;
|
||||
artifactSuffix?: string;
|
||||
isGeneric?: false;
|
||||
} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
|
||||
export declare type ElectronGenericArtifactDetails = {
|
||||
isGeneric: true;
|
||||
} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
|
||||
export declare type ElectronArtifactDetails = ElectronPlatformArtifactDetails | ElectronGenericArtifactDetails;
|
||||
export declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
export declare type ElectronPlatformArtifactDetailsWithDefaults = (Omit<ElectronPlatformArtifactDetails, 'platform' | 'arch'> & {
|
||||
platform?: string;
|
||||
arch?: string;
|
||||
}) | ElectronGenericArtifactDetails;
|
|
@ -1,3 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@ -1,25 +0,0 @@
|
|||
export declare function withTempDirectoryIn<T>(parentDirectory: string | undefined, fn: (directory: string) => Promise<T>): Promise<T>;
|
||||
export declare function withTempDirectory<T>(fn: (directory: string) => Promise<T>): Promise<T>;
|
||||
export declare function normalizeVersion(version: string): string;
|
||||
/**
|
||||
* Runs the `uname` command and returns the trimmed output.
|
||||
*/
|
||||
export declare function uname(): string;
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name.
|
||||
*/
|
||||
export declare function getNodeArch(arch: string): string;
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name, from the `process` module information.
|
||||
*/
|
||||
export declare function getHostArch(): string;
|
||||
export declare function ensureIsTruthyString<T, K extends keyof T>(obj: T, key: K): void;
|
||||
export declare function isOfficialLinuxIA32Download(platform: string, arch: string, version: string, mirrorOptions?: object): boolean;
|
||||
/**
|
||||
* Find the value of a environment variable which may or may not have the
|
||||
* prefix, in a case-insensitive manner.
|
||||
*/
|
||||
export declare function getEnv(prefix?: string): (name: string) => string | undefined;
|
||||
export declare function setEnv(key: string, value: string | undefined): void;
|
|
@ -1,107 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const childProcess = require("child_process");
|
||||
const fs = require("fs-extra");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
async function useAndRemoveDirectory(directory, fn) {
|
||||
let result;
|
||||
try {
|
||||
result = await fn(directory);
|
||||
}
|
||||
finally {
|
||||
await fs.remove(directory);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async function withTempDirectoryIn(parentDirectory = os.tmpdir(), fn) {
|
||||
const tempDirectoryPrefix = 'electron-download-';
|
||||
const tempDirectory = await fs.mkdtemp(path.resolve(parentDirectory, tempDirectoryPrefix));
|
||||
return useAndRemoveDirectory(tempDirectory, fn);
|
||||
}
|
||||
exports.withTempDirectoryIn = withTempDirectoryIn;
|
||||
async function withTempDirectory(fn) {
|
||||
return withTempDirectoryIn(undefined, fn);
|
||||
}
|
||||
exports.withTempDirectory = withTempDirectory;
|
||||
function normalizeVersion(version) {
|
||||
if (!version.startsWith('v')) {
|
||||
return `v${version}`;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
exports.normalizeVersion = normalizeVersion;
|
||||
/**
|
||||
* Runs the `uname` command and returns the trimmed output.
|
||||
*/
|
||||
function uname() {
|
||||
return childProcess
|
||||
.execSync('uname -m')
|
||||
.toString()
|
||||
.trim();
|
||||
}
|
||||
exports.uname = uname;
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name.
|
||||
*/
|
||||
function getNodeArch(arch) {
|
||||
if (arch === 'arm') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
switch (process.config.variables.arm_version) {
|
||||
case '6':
|
||||
return uname();
|
||||
case '7':
|
||||
default:
|
||||
return 'armv7l';
|
||||
}
|
||||
}
|
||||
return arch;
|
||||
}
|
||||
exports.getNodeArch = getNodeArch;
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name, from the `process` module information.
|
||||
*/
|
||||
function getHostArch() {
|
||||
return getNodeArch(process.arch);
|
||||
}
|
||||
exports.getHostArch = getHostArch;
|
||||
function ensureIsTruthyString(obj, key) {
|
||||
if (!obj[key] || typeof obj[key] !== 'string') {
|
||||
throw new Error(`Expected property "${key}" to be provided as a string but it was not`);
|
||||
}
|
||||
}
|
||||
exports.ensureIsTruthyString = ensureIsTruthyString;
|
||||
function isOfficialLinuxIA32Download(platform, arch, version, mirrorOptions) {
|
||||
return (platform === 'linux' &&
|
||||
arch === 'ia32' &&
|
||||
Number(version.slice(1).split('.')[0]) >= 4 &&
|
||||
typeof mirrorOptions === 'undefined');
|
||||
}
|
||||
exports.isOfficialLinuxIA32Download = isOfficialLinuxIA32Download;
|
||||
/**
|
||||
* Find the value of a environment variable which may or may not have the
|
||||
* prefix, in a case-insensitive manner.
|
||||
*/
|
||||
function getEnv(prefix = '') {
|
||||
const envsLowerCase = {};
|
||||
for (const envKey in process.env) {
|
||||
envsLowerCase[envKey.toLowerCase()] = process.env[envKey];
|
||||
}
|
||||
return (name) => {
|
||||
return (envsLowerCase[`${prefix}${name}`.toLowerCase()] ||
|
||||
envsLowerCase[name.toLowerCase()] ||
|
||||
undefined);
|
||||
};
|
||||
}
|
||||
exports.getEnv = getEnv;
|
||||
function setEnv(key, value) {
|
||||
// The `void` operator always returns `undefined`.
|
||||
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void
|
||||
if (value !== void 0) {
|
||||
process.env[key] = value;
|
||||
}
|
||||
}
|
||||
exports.setEnv = setEnv;
|
||||
//# sourceMappingURL=utils.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;AAAA,8CAA8C;AAC9C,+BAA+B;AAC/B,yBAAyB;AACzB,6BAA6B;AAE7B,KAAK,UAAU,qBAAqB,CAClC,SAAiB,EACjB,EAAqC;IAErC,IAAI,MAAS,CAAC;IACd,IAAI;QACF,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;KAC9B;YAAS;QACR,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;KAC5B;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAEM,KAAK,UAAU,mBAAmB,CACvC,kBAA0B,EAAE,CAAC,MAAM,EAA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ot?: string);
|
||||
static getCacheDirectory(downloadUrl: string): string;
|
||||
getCachePath(downloadUrl: string, fileName: string): string;
|
||||
getPathForFileInCache(url: string, fileName: string): Promise<string | null>;
|
||||
putFileInCache(url: string, currentPath: string, fileName: string): Promise<string>;
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
import debug from 'debug';
|
||||
import envPaths from 'env-paths';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
import * as crypto from 'crypto';
|
||||
const d = debug('@electron/get:cache');
|
||||
const defaultCacheRoot = envPaths('electron', {
|
||||
suffix: '',
|
||||
}).cache;
|
||||
export class Cache {
|
||||
constructor(cacheRoot = defaultCacheRoot) {
|
||||
this.cacheRoot = cacheRoot;
|
||||
}
|
||||
static getCacheDirectory(downloadUrl) {
|
||||
const parsedDownloadUrl = url.parse(downloadUrl);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { search, hash, pathname } = parsedDownloadUrl, rest = __rest(parsedDownloadUrl, ["search", "hash", "pathname"]);
|
||||
const strippedUrl = url.format(Object.assign(Object.assign({}, rest), { pathname: path.dirname(pathname || 'electron') }));
|
||||
return crypto
|
||||
.createHash('sha256')
|
||||
.update(strippedUrl)
|
||||
.digest('hex');
|
||||
}
|
||||
getCachePath(downloadUrl, fileName) {
|
||||
return path.resolve(this.cacheRoot, Cache.getCacheDirectory(downloadUrl), fileName);
|
||||
}
|
||||
async getPathForFileInCache(url, fileName) {
|
||||
const cachePath = this.getCachePath(url, fileName);
|
||||
if (await fs.pathExists(cachePath)) {
|
||||
return cachePath;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
async putFileInCache(url, currentPath, fileName) {
|
||||
const cachePath = this.getCachePath(url, fileName);
|
||||
d(`Moving ${currentPath} to ${cachePath}`);
|
||||
if (await fs.pathExists(cachePath)) {
|
||||
d('* Replacing existing file');
|
||||
await fs.remove(cachePath);
|
||||
}
|
||||
await fs.move(currentPath, cachePath);
|
||||
return cachePath;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=Cache.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../src/Cache.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,UAAU,EAAE;IAC5C,MAAM,EAAE,EAAE;CACX,CAAC,CAAC,KAAK,CAAC;AAET,MAAM,OAAO,KAAK;IAChB,YAAoB,YAAY,gBAAgB;QAA5B,cAAS,GAAT,SAAS,CAAmB;IAAG,CAAC;IAE7C,MAAM,CAAC,iBAAiB,CAAC,WAAmB;QACjD,MAAM,iBAAiB,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACjD,6DAA6D;QAC7D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAc,iBAAiB,EAA7B,gEAA6B,CAAC;QAC9D,MAAM,WAAW,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
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
//# sourceMappingURL=Downloader.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"Downloader.js","sourceRoot":"","sources":["../../src/Downloader.ts"],"names":[],"mappings":""}
|
|
@ -1,19 +0,0 @@
|
|||
import * as got from 'got';
|
||||
import { Downloader } from './Downloader';
|
||||
/**
|
||||
* See [`got#options`](https://github.com/sindresorhus/got#options) for possible keys/values.
|
||||
*/
|
||||
export declare type GotDownloaderOptions = got.GotOptions<string | null> & {
|
||||
/**
|
||||
* if defined, triggers every time `got`'s `downloadProgress` event callback is triggered.
|
||||
*/
|
||||
getProgressCallback?: (progress: got.Progress) => Promise<void>;
|
||||
/**
|
||||
* if `true`, disables the console progress bar (setting the `ELECTRON_GET_NO_PROGRESS`
|
||||
* environment variable to a non-empty value also does this).
|
||||
*/
|
||||
quiet?: boolean;
|
||||
};
|
||||
export declare class GotDownloader implements Downloader<GotDownloaderOptions> {
|
||||
download(url: string, targetFilePath: string, options?: GotDownloaderOptions): Promise<void>;
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
var __rest = (this && this.__rest) || function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
import * as fs from 'fs-extra';
|
||||
import * as got from 'got';
|
||||
import * as path from 'path';
|
||||
import * as ProgressBar from 'progress';
|
||||
const PROGRESS_BAR_DELAY_IN_SECONDS = 30;
|
||||
export class GotDownloader {
|
||||
async download(url, targetFilePath, options) {
|
||||
if (!options) {
|
||||
options = {};
|
||||
}
|
||||
const { quiet, getProgressCallback } = options, gotOptions = __rest(options, ["quiet", "getProgressCallback"]);
|
||||
let downloadCompleted = false;
|
||||
let bar;
|
||||
let progressPercent;
|
||||
let timeout = undefined;
|
||||
await fs.mkdirp(path.dirname(targetFilePath));
|
||||
const writeStream = fs.createWriteStream(targetFilePath);
|
||||
if (!quiet || !process.env.ELECTRON_GET_NO_PROGRESS) {
|
||||
const start = new Date();
|
||||
timeout = setTimeout(() => {
|
||||
if (!downloadCompleted) {
|
||||
bar = new ProgressBar(`Downloading ${path.basename(url)}: [:bar] :percent ETA: :eta seconds `, {
|
||||
curr: progressPercent,
|
||||
total: 100,
|
||||
});
|
||||
// https://github.com/visionmedia/node-progress/issues/159
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
bar.start = start;
|
||||
}
|
||||
}, PROGRESS_BAR_DELAY_IN_SECONDS * 1000);
|
||||
}
|
||||
await new Promise((resolve, reject) => {
|
||||
const downloadStream = got.stream(url, gotOptions);
|
||||
downloadStream.on('downloadProgress', async (progress) => {
|
||||
progressPercent = progress.percent;
|
||||
if (bar) {
|
||||
bar.update(progress.percent);
|
||||
}
|
||||
if (getProgressCallback) {
|
||||
await getProgressCallback(progress);
|
||||
}
|
||||
});
|
||||
downloadStream.on('error', error => {
|
||||
if (error.name === 'HTTPError' && error.statusCode === 404) {
|
||||
error.message += ` for ${error.url}`;
|
||||
}
|
||||
if (writeStream.destroy) {
|
||||
writeStream.destroy(error);
|
||||
}
|
||||
reject(error);
|
||||
});
|
||||
writeStream.on('error', error => reject(error));
|
||||
writeStream.on('close', () => resolve());
|
||||
downloadStream.pipe(writeStream);
|
||||
});
|
||||
downloadCompleted = true;
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=GotDownloader.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"GotDownloader.js","sourceRoot":"","sources":["../../src/GotDownloader.ts"],"names":[],"mappings":";;;;;;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
|
|||
import { ElectronArtifactDetails } from './types';
|
||||
export declare function getArtifactFileName(details: ElectronArtifactDetails): string;
|
||||
export declare function getArtifactRemoteURL(details: ElectronArtifactDetails): Promise<string>;
|
|
@ -1,52 +0,0 @@
|
|||
import { ensureIsTruthyString } from './utils';
|
||||
const BASE_URL = 'https://github.com/electron/electron/releases/download/';
|
||||
const NIGHTLY_BASE_URL = 'https://github.com/electron/nightlies/releases/download/';
|
||||
export function getArtifactFileName(details) {
|
||||
ensureIsTruthyString(details, 'artifactName');
|
||||
if (details.isGeneric) {
|
||||
return details.artifactName;
|
||||
}
|
||||
ensureIsTruthyString(details, 'arch');
|
||||
ensureIsTruthyString(details, 'platform');
|
||||
ensureIsTruthyString(details, 'version');
|
||||
return `${[
|
||||
details.artifactName,
|
||||
details.version,
|
||||
details.platform,
|
||||
details.arch,
|
||||
...(details.artifactSuffix ? [details.artifactSuffix] : []),
|
||||
].join('-')}.zip`;
|
||||
}
|
||||
function mirrorVar(name, options, defaultValue) {
|
||||
// Convert camelCase to camel_case for env var reading
|
||||
const lowerName = name.replace(/([a-z])([A-Z])/g, (_, a, b) => `${a}_${b}`).toLowerCase();
|
||||
return (process.env[`NPM_CONFIG_ELECTRON_${lowerName.toUpperCase()}`] ||
|
||||
process.env[`npm_config_electron_${lowerName}`] ||
|
||||
process.env[`npm_package_config_electron_${lowerName}`] ||
|
||||
process.env[`ELECTRON_${lowerName.toUpperCase()}`] ||
|
||||
options[name] ||
|
||||
defaultValue);
|
||||
}
|
||||
export async function getArtifactRemoteURL(details) {
|
||||
const opts = details.mirrorOptions || {};
|
||||
let base = mirrorVar('mirror', opts, BASE_URL);
|
||||
if (details.version.includes('nightly')) {
|
||||
const nightlyDeprecated = mirrorVar('nightly_mirror', opts, '');
|
||||
if (nightlyDeprecated) {
|
||||
base = nightlyDeprecated;
|
||||
console.warn(`nightly_mirror is deprecated, please use nightlyMirror`);
|
||||
}
|
||||
else {
|
||||
base = mirrorVar('nightlyMirror', opts, NIGHTLY_BASE_URL);
|
||||
}
|
||||
}
|
||||
const path = mirrorVar('customDir', opts, details.version).replace('{{ version }}', details.version.replace(/^v/, ''));
|
||||
const file = mirrorVar('customFilename', opts, getArtifactFileName(details));
|
||||
// Allow customized download URL resolution.
|
||||
if (opts.resolveAssetURL) {
|
||||
const url = await opts.resolveAssetURL(details);
|
||||
return url;
|
||||
}
|
||||
return `${base}${path}/${file}`;
|
||||
}
|
||||
//# sourceMappingURL=artifact-utils.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"artifact-utils.js","sourceRoot":"","sources":["../../src/artifact-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,QAAQ,GAAG,yDAAyD,CAAC;AAC3E,MAAM,gBAAgB,GAAG,0DAA0D,CAAC;AAEpF,MAAM,UAAU,mBAAmB,CAAC,OAAgC;IAClE,oBAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAE9C,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,OAAO,OAAO,CAAC,YAAY,CAAC;KAC7B;IAED,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACtC,oBAAoB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1C,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAEzC,OAAO,GAAG;QACR,OAAO,CAAC,YAAY;QACpB,OAAO,CAAC,OAAO;QACf,OAAO,CAAC,QAAQ;QAChB,OAAO,CAAC,IAAI;QACZ,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5D,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC;AAED,SAAS,SAAS,CAChB,IAAkD,EAClD,OAAsB,EACtB,YAAoB;IAEpB,sDAAsD;IACtD,MAAM,SAAS,GAA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,MAAM,IAAI,GAAG,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;IAE7E,4CAA4C;IAC5C,IAAI,IAAI,CAAC,eAAe,EAAE;QACxB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,GAAG,CAAC;KACZ;IAED,OAAO,GAAG,IAAI,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;AAClC,CAAC"}
|
|
@ -1,3 +0,0 @@
|
|||
import { DownloadOptions } from './types';
|
||||
import { Downloader } from './Downloader';
|
||||
export declare function getDownloaderForSystem(): Promise<Downloader<DownloadOptions>>;
|
|
@ -1,9 +0,0 @@
|
|||
export async function getDownloaderForSystem() {
|
||||
// TODO: Resolve the downloader or default to GotDownloader
|
||||
// Current thoughts are a dot-file traversal for something like
|
||||
// ".electron.downloader" which would be a text file with the name of the
|
||||
// npm module to import() and use as the downloader
|
||||
const { GotDownloader } = await import('./GotDownloader');
|
||||
return new GotDownloader();
|
||||
}
|
||||
//# sourceMappingURL=downloader-resolver.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"downloader-resolver.js","sourceRoot":"","sources":["../../src/downloader-resolver.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,2DAA2D;IAC3D,+DAA+D;IAC/D,yEAAyE;IACzE,mDAAmD;IACnD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC1D,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC"}
|
|
@ -1,18 +0,0 @@
|
|||
import { ElectronDownloadRequestOptions, ElectronPlatformArtifactDetailsWithDefaults } from './types';
|
||||
export { getHostArch } from './utils';
|
||||
export { initializeProxy } from './proxy';
|
||||
export * from './types';
|
||||
/**
|
||||
* Downloads an artifact from an Electron release and returns an absolute path
|
||||
* to the downloaded file.
|
||||
*
|
||||
* @param artifactDetails - The information required to download the artifact
|
||||
*/
|
||||
export declare function downloadArtifact(_artifactDetails: ElectronPlatformArtifactDetailsWithDefaults): Promise<string>;
|
||||
/**
|
||||
* Downloads a specific version of Electron and returns an absolute path to a
|
||||
* ZIP file.
|
||||
*
|
||||
* @param version - The version of Electron you want to download
|
||||
*/
|
||||
export declare function download(version: string, options?: ElectronDownloadRequestOptions): Promise<string>;
|
|
@ -1,124 +0,0 @@
|
|||
import debug from 'debug';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as path from 'path';
|
||||
import * as semver from 'semver';
|
||||
import * as sumchecker from 'sumchecker';
|
||||
import { getArtifactFileName, getArtifactRemoteURL } from './artifact-utils';
|
||||
import { Cache } from './Cache';
|
||||
import { getDownloaderForSystem } from './downloader-resolver';
|
||||
import { initializeProxy } from './proxy';
|
||||
import { withTempDirectoryIn, normalizeVersion, getHostArch, getNodeArch, ensureIsTruthyString, isOfficialLinuxIA32Download, withTempDirectory, } from './utils';
|
||||
export { getHostArch } from './utils';
|
||||
export { initializeProxy } from './proxy';
|
||||
const d = debug('@electron/get:index');
|
||||
if (process.env.ELECTRON_GET_USE_PROXY) {
|
||||
initializeProxy();
|
||||
}
|
||||
/**
|
||||
* Downloads an artifact from an Electron release and returns an absolute path
|
||||
* to the downloaded file.
|
||||
*
|
||||
* @param artifactDetails - The information required to download the artifact
|
||||
*/
|
||||
export async function downloadArtifact(_artifactDetails) {
|
||||
const artifactDetails = Object.assign({}, _artifactDetails);
|
||||
if (!_artifactDetails.isGeneric) {
|
||||
const platformArtifactDetails = artifactDetails;
|
||||
if (!platformArtifactDetails.platform) {
|
||||
d('No platform found, defaulting to the host platform');
|
||||
platformArtifactDetails.platform = process.platform;
|
||||
}
|
||||
if (platformArtifactDetails.arch) {
|
||||
platformArtifactDetails.arch = getNodeArch(platformArtifactDetails.arch);
|
||||
}
|
||||
else {
|
||||
d('No arch found, defaulting to the host arch');
|
||||
platformArtifactDetails.arch = getHostArch();
|
||||
}
|
||||
}
|
||||
ensureIsTruthyString(artifactDetails, 'version');
|
||||
artifactDetails.version = normalizeVersion(process.env.ELECTRON_CUSTOM_VERSION || artifactDetails.version);
|
||||
const fileName = getArtifactFileName(artifactDetails);
|
||||
const url = await getArtifactRemoteURL(artifactDetails);
|
||||
const cache = new Cache(artifactDetails.cacheRoot);
|
||||
// Do not check if the file exists in the cache when force === true
|
||||
if (!artifactDetails.force) {
|
||||
d(`Checking the cache (${artifactDetails.cacheRoot}) for ${fileName} (${url})`);
|
||||
const cachedPath = await cache.getPathForFileInCache(url, fileName);
|
||||
if (cachedPath === null) {
|
||||
d('Cache miss');
|
||||
}
|
||||
else {
|
||||
d('Cache hit');
|
||||
return cachedPath;
|
||||
}
|
||||
}
|
||||
if (!artifactDetails.isGeneric &&
|
||||
isOfficialLinuxIA32Download(artifactDetails.platform, artifactDetails.arch, artifactDetails.version, artifactDetails.mirrorOptions)) {
|
||||
console.warn('Official Linux/ia32 support is deprecated.');
|
||||
console.warn('For more info: https://electronjs.org/blog/linux-32bit-support');
|
||||
}
|
||||
return await withTempDirectoryIn(artifactDetails.tempDirectory, async (tempFolder) => {
|
||||
const tempDownloadPath = path.resolve(tempFolder, getArtifactFileName(artifactDetails));
|
||||
const downloader = artifactDetails.downloader || (await getDownloaderForSystem());
|
||||
d(`Downloading ${url} to ${tempDownloadPath} with options: ${JSON.stringify(artifactDetails.downloadOptions)}`);
|
||||
await downloader.download(url, tempDownloadPath, artifactDetails.downloadOptions);
|
||||
// Don't try to verify the hash of the hash file itself
|
||||
// and for older versions that don't have a SHASUMS256.txt
|
||||
if (!artifactDetails.artifactName.startsWith('SHASUMS256') &&
|
||||
!artifactDetails.unsafelyDisableChecksums &&
|
||||
semver.gte(artifactDetails.version, '1.3.2')) {
|
||||
await withTempDirectory(async (tmpDir) => {
|
||||
let shasumPath;
|
||||
const checksums = artifactDetails.checksums;
|
||||
if (checksums) {
|
||||
shasumPath = path.resolve(tmpDir, 'SHASUMS256.txt');
|
||||
const fileNames = Object.keys(checksums);
|
||||
if (fileNames.length === 0) {
|
||||
throw new Error('Provided "checksums" object is empty, cannot generate a valid SHASUMS256.txt');
|
||||
}
|
||||
const generatedChecksums = fileNames
|
||||
.map(fileName => `${checksums[fileName]} *${fileName}`)
|
||||
.join('\n');
|
||||
await fs.writeFile(shasumPath, generatedChecksums);
|
||||
}
|
||||
else {
|
||||
shasumPath = await downloadArtifact({
|
||||
isGeneric: true,
|
||||
version: artifactDetails.version,
|
||||
artifactName: 'SHASUMS256.txt',
|
||||
force: artifactDetails.force,
|
||||
downloadOptions: artifactDetails.downloadOptions,
|
||||
cacheRoot: artifactDetails.cacheRoot,
|
||||
downloader: artifactDetails.downloader,
|
||||
mirrorOptions: artifactDetails.mirrorOptions,
|
||||
});
|
||||
}
|
||||
// For versions 1.3.2 - 1.3.4, need to overwrite the `defaultTextEncoding` option:
|
||||
// https://github.com/electron/electron/pull/6676#discussion_r75332120
|
||||
if (semver.satisfies(artifactDetails.version, '1.3.2 - 1.3.4')) {
|
||||
const validatorOptions = {};
|
||||
validatorOptions.defaultTextEncoding = 'binary';
|
||||
const checker = new sumchecker.ChecksumValidator('sha256', shasumPath, validatorOptions);
|
||||
await checker.validate(path.dirname(tempDownloadPath), path.basename(tempDownloadPath));
|
||||
}
|
||||
else {
|
||||
await sumchecker('sha256', shasumPath, path.dirname(tempDownloadPath), [
|
||||
path.basename(tempDownloadPath),
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
return await cache.putFileInCache(url, tempDownloadPath, fileName);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Downloads a specific version of Electron and returns an absolute path to a
|
||||
* ZIP file.
|
||||
*
|
||||
* @param version - The version of Electron you want to download
|
||||
*/
|
||||
export function download(version, options) {
|
||||
return downloadArtifact(Object.assign(Object.assign({}, options), { version, platform: process.platform, arch: process.arch, artifactName: 'electron' }));
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
|
@ -1 +0,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;AACH,MAAM,UAAU,QAAQ,CACtB,OAAe,EACf,OAAwC;IAExC,OAAO,gBAAgB,iCAClB,OAAO,KACV,OAAO,EACP,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAC1B,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,YAAY,EAAE,UAAU,IACxB,CAAC;AACL,CAAC"}
|
|
@ -1,4 +0,0 @@
|
|||
/**
|
||||
* Initializes a third-party proxy module for HTTP(S) requests.
|
||||
*/
|
||||
export declare function initializeProxy(): void;
|
|
@ -1,29 +0,0 @@
|
|||
import * as debug from 'debug';
|
||||
import { getEnv, setEnv } from './utils';
|
||||
const d = debug('@electron/get:proxy');
|
||||
/**
|
||||
* Initializes a third-party proxy module for HTTP(S) requests.
|
||||
*/
|
||||
export function initializeProxy() {
|
||||
try {
|
||||
// Code originally from https://github.com/yeoman/yo/blob/b2eea87e/lib/cli.js#L19-L28
|
||||
const MAJOR_NODEJS_VERSION = parseInt(process.version.slice(1).split('.')[0], 10);
|
||||
if (MAJOR_NODEJS_VERSION >= 10) {
|
||||
// See: https://github.com/electron/get/pull/214#discussion_r798845713
|
||||
const env = getEnv('GLOBAL_AGENT_');
|
||||
setEnv('GLOBAL_AGENT_HTTP_PROXY', env('HTTP_PROXY'));
|
||||
setEnv('GLOBAL_AGENT_HTTPS_PROXY', env('HTTPS_PROXY'));
|
||||
setEnv('GLOBAL_AGENT_NO_PROXY', env('NO_PROXY'));
|
||||
// `global-agent` works with Node.js v10 and above.
|
||||
require('global-agent').bootstrap();
|
||||
}
|
||||
else {
|
||||
// `global-tunnel-ng` works with Node.js v10 and below.
|
||||
require('global-tunnel-ng').initialize();
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
d('Could not load either proxy modules, built-in proxy support not available:', e);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=proxy.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,CAAC,GAAG,KAAK,CAAC,qBAAqB,CAAC,CAAC;AAEvC;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI;QACF,qFAAqF;QACrF,MAAM,oBAAoB,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAElF,IAAI,oBAAoB,IAAI,EAAE,EAAE;YAC9B,sEAAsE;YACtE,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;YAEpC,MAAM,CAAC,yBAAyB,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC;YACrD,MAAM,CAAC,0BAA0B,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;YACvD,MAAM,CAAC,uBAAuB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;YAEjD,mDAAmD;YACnD,OAAO,CAAC,cAAc,CAAC,CAAC,SAAS,EAAE,CAAC;SACrC;aAAM;YACL,uDAAuD;YACvD,OAAO,CAAC,kBAAkB,CAAC,CAAC,UAAU,EAAE,CAAC;SAC1C;KACF;IAAC,OAAO,CAAC,EAAE;QACV,CAAC,CAAC,4EAA4E,EAAE,CAAC,CAAC,CAAC;KACpF;AACH,CAAC"}
|
|
@ -1,124 +0,0 @@
|
|||
import { Downloader } from './Downloader';
|
||||
export declare type DownloadOptions = any;
|
||||
export interface MirrorOptions {
|
||||
/**
|
||||
* DEPRECATED - see nightlyMirror.
|
||||
*/
|
||||
nightly_mirror?: string;
|
||||
/**
|
||||
* The Electron nightly-specific mirror URL.
|
||||
*/
|
||||
nightlyMirror?: string;
|
||||
/**
|
||||
* The base URL of the mirror to download from,
|
||||
* e.g https://github.com/electron/electron/releases/download
|
||||
*/
|
||||
mirror?: string;
|
||||
/**
|
||||
* The name of the directory to download from,
|
||||
* often scoped by version number e.g 'v4.0.4'
|
||||
*/
|
||||
customDir?: string;
|
||||
/**
|
||||
* The name of the asset to download,
|
||||
* e.g 'electron-v4.0.4-linux-x64.zip'
|
||||
*/
|
||||
customFilename?: string;
|
||||
/**
|
||||
* A function allowing customization of the url returned
|
||||
* from getArtifactRemoteURL().
|
||||
*/
|
||||
resolveAssetURL?: (opts: DownloadOptions) => Promise<string>;
|
||||
}
|
||||
export interface ElectronDownloadRequest {
|
||||
/**
|
||||
* The version of Electron associated with the artifact.
|
||||
*/
|
||||
version: string;
|
||||
/**
|
||||
* The type of artifact. For example:
|
||||
* * `electron`
|
||||
* * `ffmpeg`
|
||||
*/
|
||||
artifactName: string;
|
||||
}
|
||||
export interface ElectronDownloadRequestOptions {
|
||||
/**
|
||||
* Whether to download an artifact regardless of whether it's in the cache directory.
|
||||
*
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
force?: boolean;
|
||||
/**
|
||||
* When set to `true`, disables checking that the artifact download completed successfully
|
||||
* with the correct payload.
|
||||
*
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
unsafelyDisableChecksums?: boolean;
|
||||
/**
|
||||
* Provides checksums for the artifact as strings.
|
||||
* Can be used if you already know the checksums of the Electron artifact
|
||||
* you are downloading and want to skip the checksum file download
|
||||
* without skipping the checksum validation.
|
||||
*
|
||||
* This should be an object whose keys are the file names of the artifacts and
|
||||
* the values are their respective SHA256 checksums.
|
||||
*/
|
||||
checksums?: Record<string, string>;
|
||||
/**
|
||||
* The directory that caches Electron artifact downloads.
|
||||
*
|
||||
* The default value is dependent upon the host platform:
|
||||
*
|
||||
* * Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
|
||||
* * MacOS: `~/Library/Caches/electron/`
|
||||
* * Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
|
||||
*/
|
||||
cacheRoot?: string;
|
||||
/**
|
||||
* Options passed to the downloader module.
|
||||
*/
|
||||
downloadOptions?: DownloadOptions;
|
||||
/**
|
||||
* Options related to specifying an artifact mirror.
|
||||
*/
|
||||
mirrorOptions?: MirrorOptions;
|
||||
/**
|
||||
* The custom [[Downloader]] class used to download artifacts. Defaults to the
|
||||
* built-in [[GotDownloader]].
|
||||
*/
|
||||
downloader?: Downloader<DownloadOptions>;
|
||||
/**
|
||||
* A temporary directory for downloads.
|
||||
* It is used before artifacts are put into cache.
|
||||
*/
|
||||
tempDirectory?: string;
|
||||
}
|
||||
export declare type ElectronPlatformArtifactDetails = {
|
||||
/**
|
||||
* The target artifact platform. These are Node-style platform names, for example:
|
||||
* * `win32`
|
||||
* * `darwin`
|
||||
* * `linux`
|
||||
*/
|
||||
platform: string;
|
||||
/**
|
||||
* The target artifact architecture. These are Node-style architecture names, for example:
|
||||
* * `ia32`
|
||||
* * `x64`
|
||||
* * `armv7l`
|
||||
*/
|
||||
arch: string;
|
||||
artifactSuffix?: string;
|
||||
isGeneric?: false;
|
||||
} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
|
||||
export declare type ElectronGenericArtifactDetails = {
|
||||
isGeneric: true;
|
||||
} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
|
||||
export declare type ElectronArtifactDetails = ElectronPlatformArtifactDetails | ElectronGenericArtifactDetails;
|
||||
export declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
||||
export declare type ElectronPlatformArtifactDetailsWithDefaults = (Omit<ElectronPlatformArtifactDetails, 'platform' | 'arch'> & {
|
||||
platform?: string;
|
||||
arch?: string;
|
||||
}) | ElectronGenericArtifactDetails;
|
|
@ -1 +0,0 @@
|
|||
//# sourceMappingURL=types.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@ -1,25 +0,0 @@
|
|||
export declare function withTempDirectoryIn<T>(parentDirectory: string | undefined, fn: (directory: string) => Promise<T>): Promise<T>;
|
||||
export declare function withTempDirectory<T>(fn: (directory: string) => Promise<T>): Promise<T>;
|
||||
export declare function normalizeVersion(version: string): string;
|
||||
/**
|
||||
* Runs the `uname` command and returns the trimmed output.
|
||||
*/
|
||||
export declare function uname(): string;
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name.
|
||||
*/
|
||||
export declare function getNodeArch(arch: string): string;
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name, from the `process` module information.
|
||||
*/
|
||||
export declare function getHostArch(): string;
|
||||
export declare function ensureIsTruthyString<T, K extends keyof T>(obj: T, key: K): void;
|
||||
export declare function isOfficialLinuxIA32Download(platform: string, arch: string, version: string, mirrorOptions?: object): boolean;
|
||||
/**
|
||||
* Find the value of a environment variable which may or may not have the
|
||||
* prefix, in a case-insensitive manner.
|
||||
*/
|
||||
export declare function getEnv(prefix?: string): (name: string) => string | undefined;
|
||||
export declare function setEnv(key: string, value: string | undefined): void;
|
|
@ -1,95 +0,0 @@
|
|||
import * as childProcess from 'child_process';
|
||||
import * as fs from 'fs-extra';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
async function useAndRemoveDirectory(directory, fn) {
|
||||
let result;
|
||||
try {
|
||||
result = await fn(directory);
|
||||
}
|
||||
finally {
|
||||
await fs.remove(directory);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export async function withTempDirectoryIn(parentDirectory = os.tmpdir(), fn) {
|
||||
const tempDirectoryPrefix = 'electron-download-';
|
||||
const tempDirectory = await fs.mkdtemp(path.resolve(parentDirectory, tempDirectoryPrefix));
|
||||
return useAndRemoveDirectory(tempDirectory, fn);
|
||||
}
|
||||
export async function withTempDirectory(fn) {
|
||||
return withTempDirectoryIn(undefined, fn);
|
||||
}
|
||||
export function normalizeVersion(version) {
|
||||
if (!version.startsWith('v')) {
|
||||
return `v${version}`;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
/**
|
||||
* Runs the `uname` command and returns the trimmed output.
|
||||
*/
|
||||
export function uname() {
|
||||
return childProcess
|
||||
.execSync('uname -m')
|
||||
.toString()
|
||||
.trim();
|
||||
}
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name.
|
||||
*/
|
||||
export function getNodeArch(arch) {
|
||||
if (arch === 'arm') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
switch (process.config.variables.arm_version) {
|
||||
case '6':
|
||||
return uname();
|
||||
case '7':
|
||||
default:
|
||||
return 'armv7l';
|
||||
}
|
||||
}
|
||||
return arch;
|
||||
}
|
||||
/**
|
||||
* Generates an architecture name that would be used in an Electron or Node.js
|
||||
* download file name, from the `process` module information.
|
||||
*/
|
||||
export function getHostArch() {
|
||||
return getNodeArch(process.arch);
|
||||
}
|
||||
export function ensureIsTruthyString(obj, key) {
|
||||
if (!obj[key] || typeof obj[key] !== 'string') {
|
||||
throw new Error(`Expected property "${key}" to be provided as a string but it was not`);
|
||||
}
|
||||
}
|
||||
export function isOfficialLinuxIA32Download(platform, arch, version, mirrorOptions) {
|
||||
return (platform === 'linux' &&
|
||||
arch === 'ia32' &&
|
||||
Number(version.slice(1).split('.')[0]) >= 4 &&
|
||||
typeof mirrorOptions === 'undefined');
|
||||
}
|
||||
/**
|
||||
* Find the value of a environment variable which may or may not have the
|
||||
* prefix, in a case-insensitive manner.
|
||||
*/
|
||||
export function getEnv(prefix = '') {
|
||||
const envsLowerCase = {};
|
||||
for (const envKey in process.env) {
|
||||
envsLowerCase[envKey.toLowerCase()] = process.env[envKey];
|
||||
}
|
||||
return (name) => {
|
||||
return (envsLowerCase[`${prefix}${name}`.toLowerCase()] ||
|
||||
envsLowerCase[name.toLowerCase()] ||
|
||||
undefined);
|
||||
};
|
||||
}
|
||||
export function setEnv(key, value) {
|
||||
// The `void` operator always returns `undefined`.
|
||||
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void
|
||||
if (value !== void 0) {
|
||||
process.env[key] = value;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=utils.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,KAAK,UAAU,qBAAqB,CAClC,SAAiB,EACjB,EAAqC;IAErC,IAAI,MAAS,CAAC;IACd,IAAI;QACF,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;KAC9B;YAAS;QACR,MAAM,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;KAC5B;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,kBAA0B,EAAE,CAAC,MAAM,EAAE,EACrC,EAAqC;IAErC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;IACjD,MAAM,aAAa,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC3F,OAAO,qBAAqB,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAI,EAAqC;IAC9E,OAAO,mBAAmB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC5B,OAAO,IAAI,OAAO,EAAE,CAAC;KACtB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,U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AAC,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KAC3D;IAED,OAAO,CAAC,IAAY,EAAsB,EAAE;QAC1C,OAAO,CACL,aAAa,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YAC/C,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACjC,SAAS,CACV,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAW,EAAE,KAAyB;IAC3D,kDAAkD;IAClD,wFAAwF;IACxF,IAAI,KAAK,KAAK,KAAK,CAAC,EAAE;QACpB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KAC1B;AACH,CAAC"}
|
|
@ -1,102 +0,0 @@
|
|||
{
|
||||
"name": "@electron/get",
|
||||
"version": "1.14.1",
|
||||
"description": "Utility for downloading artifacts from different versions of Electron",
|
||||
"main": "dist/cjs/index.js",
|
||||
"module": "dist/esm/index.js",
|
||||
"repository": "https://github.com/electron/get",
|
||||
"author": "Samuel Attard",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "tsc && tsc -p tsconfig.esm.json",
|
||||
"build:docs": "typedoc --out docs",
|
||||
"eslint": "eslint --ext .ts src test",
|
||||
"jest": "jest --coverage",
|
||||
"lint": "npm run prettier && npm run eslint",
|
||||
"prettier": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"prepublishOnly": "npm run build",
|
||||
"test": "npm run lint && npm run jest",
|
||||
"test:nonetwork": "npm run lint && npm run jest -- --testPathIgnorePatterns network.spec"
|
||||
},
|
||||
"files": [
|
||||
"dist/*",
|
||||
"README.md"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=8.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "^4.1.1",
|
||||
"env-paths": "^2.2.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"got": "^9.6.0",
|
||||
"progress": "^2.0.3",
|
||||
"semver": "^6.2.0",
|
||||
"sumchecker": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@continuous-auth/semantic-release-npm": "^2.0.0",
|
||||
"@types/debug": "^4.1.4",
|
||||
"@types/fs-extra": "^8.0.0",
|
||||
"@types/got": "^9.4.4",
|
||||
"@types/jest": "^24.0.13",
|
||||
"@types/node": "^12.0.2",
|
||||
"@types/progress": "^2.0.3",
|
||||
"@types/semver": "^6.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.34.0",
|
||||
"@typescript-eslint/parser": "^2.34.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.15.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-jest": "< 24.0.0",
|
||||
"husky": "^2.3.0",
|
||||
"jest": "^24.8.0",
|
||||
"lint-staged": "^8.1.7",
|
||||
"prettier": "^1.17.1",
|
||||
"ts-jest": "^24.0.0",
|
||||
"typedoc": "^0.17.2",
|
||||
"typescript": "^3.8.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:jest/recommended",
|
||||
"plugin:import/errors",
|
||||
"plugin:import/warnings",
|
||||
"plugin:import/typescript",
|
||||
"prettier",
|
||||
"prettier/@typescript-eslint"
|
||||
]
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": [
|
||||
"eslint --fix",
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"keywords": [
|
||||
"electron",
|
||||
"download",
|
||||
"prebuild",
|
||||
"get",
|
||||
"artifact",
|
||||
"release"
|
||||
],
|
||||
"optionalDependencies": {
|
||||
"global-agent": "^3.0.0",
|
||||
"global-tunnel-ng": "^2.7.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"eslint/inquirer": "< 7.3.0",
|
||||
"**/@typescript-eslint/typescript-estree/semver": "^6.3.0"
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 Federico Zivolo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,376 +0,0 @@
|
|||
<!-- <HEADER> // IGNORE IT -->
|
||||
<p align="center">
|
||||
<img src="https://rawcdn.githack.com/popperjs/popper-core/8805a5d7599e14619c9e7ac19a3713285d8e5d7f/docs/src/images/popper-logo-outlined.svg" alt="Popper" height="300px"/>
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<h1>Tooltip & Popover Positioning Engine</h1>
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/@popperjs/core">
|
||||
<img src="https://img.shields.io/npm/v/@popperjs/core?style=for-the-badge" alt="npm version" />
|
||||
</a>
|
||||
<a href="https://www.npmjs.com/package/@popperjs/core">
|
||||
<img src="https://img.shields.io/endpoint?style=for-the-badge&url=https://runkit.io/fezvrasta/combined-npm-downloads/1.0.0?packages=popper.js,@popperjs/core" alt="npm downloads per month (popper.js + @popperjs/core)" />
|
||||
</a>
|
||||
<a href="https://rollingversions.com/popperjs/popper-core">
|
||||
<img src="https://img.shields.io/badge/Rolling%20Versions-Enabled-brightgreen?style=for-the-badge" alt="Rolling Versions" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br />
|
||||
<!-- </HEADER> // NOW BEGINS THE README -->
|
||||
|
||||
**Positioning tooltips and popovers is difficult. Popper is here to help!**
|
||||
|
||||
Given an element, such as a button, and a tooltip element describing it, Popper
|
||||
will automatically put the tooltip in the right place near the button.
|
||||
|
||||
It will position _any_ UI element that "pops out" from the flow of your document
|
||||
and floats near a target element. The most common example is a tooltip, but it
|
||||
also includes popovers, drop-downs, and more. All of these can be generically
|
||||
described as a "popper" element.
|
||||
|
||||
## Demo
|
||||
|
||||
[![Popper visualized](https://i.imgur.com/F7qWsmV.jpg)](https://popper.js.org)
|
||||
|
||||
## Docs
|
||||
|
||||
- [v2.x (latest)](https://popper.js.org/docs/v2/)
|
||||
- [v1.x](https://popper.js.org/docs/v1/)
|
||||
|
||||
We've created a
|
||||
[Migration Guide](https://popper.js.org/docs/v2/migration-guide/) to help you
|
||||
migrate from Popper 1 to Popper 2.
|
||||
|
||||
To contribute to the Popper website and documentation, please visit the
|
||||
[dedicated repository](https://github.com/popperjs/website).
|
||||
|
||||
## Why not use pure CSS?
|
||||
|
||||
- **Clipping and overflow issues**: Pure CSS poppers will not be prevented from
|
||||
overflowing clipping boundaries, such as the viewport. It will get partially
|
||||
cut off or overflows if it's near the edge since there is no dynamic
|
||||
positioning logic. When using Popper, your popper will always be positioned in
|
||||
the right place without needing manual adjustments.
|
||||
- **No flipping**: CSS poppers will not flip to a different placement to fit
|
||||
better in view if necessary. While you can manually adjust for the main axis
|
||||
overflow, this feature cannot be achieved via CSS alone. Popper automatically
|
||||
flips the tooltip to make it fit in view as best as possible for the user.
|
||||
- **No virtual positioning**: CSS poppers cannot follow the mouse cursor or be
|
||||
used as a context menu. Popper allows you to position your tooltip relative to
|
||||
any coordinates you desire.
|
||||
- **Slower development cycle**: When pure CSS is used to position popper
|
||||
elements, the lack of dynamic positioning means they must be carefully placed
|
||||
to consider overflow on all screen sizes. In reusable component libraries,
|
||||
this means a developer can't just add the component anywhere on the page,
|
||||
because these issues need to be considered and adjusted for every time. With
|
||||
Popper, you can place your elements anywhere and they will be positioned
|
||||
correctly, without needing to consider different screen sizes, layouts, etc.
|
||||
This massively speeds up development time because this work is automatically
|
||||
offloaded to Popper.
|
||||
- **Lack of extensibility**: CSS poppers cannot be easily extended to fit any
|
||||
arbitrary use case you may need to adjust for. Popper is built with
|
||||
extensibility in mind.
|
||||
|
||||
## Why Popper?
|
||||
|
||||
With the CSS drawbacks out of the way, we now move on to Popper in the
|
||||
JavaScript space itself.
|
||||
|
||||
Naive JavaScript tooltip implementations usually have the following problems:
|
||||
|
||||
- **Scrolling containers**: They don't ensure the tooltip stays with the
|
||||
reference element while scrolling when inside any number of scrolling
|
||||
containers.
|
||||
- **DOM context**: They often require the tooltip move outside of its original
|
||||
DOM context because they don't handle `offsetParent` contexts.
|
||||
- **Compatibility**: Popper handles an incredible number of edge cases regarding
|
||||
different browsers and environments (mobile viewports, RTL, scrollbars enabled
|
||||
or disabled, etc.). Popper is a popular and well-maintained library, so you
|
||||
can be confident positioning will work for your users on any device.
|
||||
- **Configurability**: They often lack advanced configurability to suit any
|
||||
possible use case.
|
||||
- **Size**: They are usually relatively large in size, or require an ancient
|
||||
jQuery dependency.
|
||||
- **Performance**: They often have runtime performance issues and update the
|
||||
tooltip position too slowly.
|
||||
|
||||
**Popper solves all of these key problems in an elegant, performant manner.** It
|
||||
is a lightweight ~3 kB library that aims to provide a reliable and extensible
|
||||
positioning engine you can use to ensure all your popper elements are positioned
|
||||
in the right place.
|
||||
|
||||
When you start writing your own popper implementation, you'll quickly run into
|
||||
all of the problems mentioned above. These widgets are incredibly common in our
|
||||
UIs; we've done the hard work figuring this out so you don't need to spend hours
|
||||
fixing and handling numerous edge cases that we already ran into while building
|
||||
the library!
|
||||
|
||||
Popper is used in popular libraries like Bootstrap, Foundation, Material UI, and
|
||||
more. It's likely you've already used popper elements on the web positioned by
|
||||
Popper at some point in the past few years.
|
||||
|
||||
Since we write UIs using powerful abstraction libraries such as React or Angular
|
||||
nowadays, you'll also be glad to know Popper can fully integrate with them and
|
||||
be a good citizen together with your other components. Check out `react-popper`
|
||||
for the official Popper wrapper for React.
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Package Manager
|
||||
|
||||
```bash
|
||||
# With npm
|
||||
npm i @popperjs/core
|
||||
|
||||
# With Yarn
|
||||
yarn add @popperjs/core
|
||||
```
|
||||
|
||||
### 2. CDN
|
||||
|
||||
```html
|
||||
<!-- Development version -->
|
||||
<script src="https://unpkg.com/@popperjs/core@2/dist/umd/popper.js"></script>
|
||||
|
||||
<!-- Production version -->
|
||||
<script src="https://unpkg.com/@popperjs/core@2"></script>
|
||||
```
|
||||
|
||||
### 3. Direct Download?
|
||||
|
||||
Managing dependencies by "directly downloading" them and placing them into your
|
||||
source code is not recommended for a variety of reasons, including missing out
|
||||
on feat/fix updates easily. Please use a versioning management system like a CDN
|
||||
or npm/Yarn.
|
||||
|
||||
## Usage
|
||||
|
||||
The most straightforward way to get started is to import Popper from the `unpkg`
|
||||
CDN, which includes all of its features. You can call the `Popper.createPopper`
|
||||
constructor to create new popper instances.
|
||||
|
||||
Here is a complete example:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<title>Popper example</title>
|
||||
|
||||
<style>
|
||||
#tooltip {
|
||||
background-color: #333;
|
||||
color: white;
|
||||
padding: 5px 10px;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<button id="button" aria-describedby="tooltip">I'm a button</button>
|
||||
<div id="tooltip" role="tooltip">I'm a tooltip</div>
|
||||
|
||||
<script src="https://unpkg.com/@popperjs/core@^2.0.0"></script>
|
||||
<script>
|
||||
const button = document.querySelector('#button');
|
||||
const tooltip = document.querySelector('#tooltip');
|
||||
|
||||
// Pass the button, the tooltip, and some options, and Popper will do the
|
||||
// magic positioning for you:
|
||||
Popper.createPopper(button, tooltip, {
|
||||
placement: 'right',
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Visit the [tutorial](https://popper.js.org/docs/v2/tutorial/) for an example of
|
||||
how to build your own tooltip from scratch using Popper.
|
||||
|
||||
### Module bundlers
|
||||
|
||||
You can import the `createPopper` constructor from the fully-featured file:
|
||||
|
||||
```js
|
||||
import { createPopper } from '@popperjs/core';
|
||||
|
||||
const button = document.querySelector('#button');
|
||||
const tooltip = document.querySelector('#tooltip');
|
||||
|
||||
// Pass the button, the tooltip, and some options, and Popper will do the
|
||||
// magic positioning for you:
|
||||
createPopper(button, tooltip, {
|
||||
placement: 'right',
|
||||
});
|
||||
```
|
||||
|
||||
All the modifiers listed in the docs menu will be enabled and "just work", so
|
||||
you don't need to think about setting Popper up. The size of Popper including
|
||||
all of its features is about 5 kB minzipped, but it may grow a bit in the
|
||||
future.
|
||||
|
||||
#### Popper Lite (tree-shaking)
|
||||
|
||||
If bundle size is important, you'll want to take advantage of tree-shaking. The
|
||||
library is built in a modular way to allow to import only the parts you really
|
||||
need.
|
||||
|
||||
```js
|
||||
import { createPopperLite as createPopper } from '@popperjs/core';
|
||||
```
|
||||
|
||||
The Lite version includes the most necessary modifiers that will compute the
|
||||
offsets of the popper, compute and add the positioning styles, and add event
|
||||
listeners. This is close in bundle size to pure CSS tooltip libraries, and
|
||||
behaves somewhat similarly.
|
||||
|
||||
However, this does not include the features that makes Popper truly useful.
|
||||
|
||||
The two most useful modifiers not included in Lite are `preventOverflow` and
|
||||
`flip`:
|
||||
|
||||
```js
|
||||
import {
|
||||
createPopperLite as createPopper,
|
||||
preventOverflow,
|
||||
flip,
|
||||
} from '@popperjs/core';
|
||||
|
||||
const button = document.querySelector('#button');
|
||||
const tooltip = document.querySelector('#tooltip');
|
||||
|
||||
createPopper(button, tooltip, {
|
||||
modifiers: [preventOverflow, flip],
|
||||
});
|
||||
```
|
||||
|
||||
As you make more poppers, you may be finding yourself needing other modifiers
|
||||
provided by the library.
|
||||
|
||||
See [tree-shaking](https://popper.js.org/docs/v2/performance/#tree-shaking) for more
|
||||
information.
|
||||
|
||||
## Distribution targets
|
||||
|
||||
Popper is distributed in 3 different versions, in 3 different file formats.
|
||||
|
||||
The 3 file formats are:
|
||||
|
||||
- `esm` (works with `import` syntax — **recommended**)
|
||||
- `umd` (works with `<script>` tags or RequireJS)
|
||||
- `cjs` (works with `require()` syntax)
|
||||
|
||||
There are two different `esm` builds, one for bundler consumers (e.g. webpack,
|
||||
Rollup, etc..), which is located under `/lib`, and one for browsers with native
|
||||
support for ES Modules, under `/dist/esm`. The only difference within the two,
|
||||
is that the browser-compatible version doesn't make use of
|
||||
`process.env.NODE_ENV` to run development checks.
|
||||
|
||||
The 3 versions are:
|
||||
|
||||
- `popper`: includes all the modifiers (features) in one file (**default**);
|
||||
- `popper-lite`: includes only the minimum amount of modifiers to provide the
|
||||
basic functionality;
|
||||
- `popper-base`: doesn't include any modifier, you must import them separately;
|
||||
|
||||
Below you can find the size of each version, minified and compressed with the
|
||||
[Brotli compression algorithm](https://medium.com/groww-engineering/enable-brotli-compression-in-webpack-with-fallback-to-gzip-397a57cf9fc6):
|
||||
|
||||
<!-- Don't change the labels to use hyphens, it breaks, even when encoded -->
|
||||
|
||||
![](https://badge-size.now.sh/https://unpkg.com/@popperjs/core/dist/umd/popper.min.js?compression=brotli&label=popper)
|
||||
![](https://badge-size.now.sh/https://unpkg.com/@popperjs/core/dist/umd/popper-lite.min.js?compression=brotli&label=popper%20lite)
|
||||
![](https://badge-size.now.sh/https://unpkg.com/@popperjs/core/dist/umd/popper-base.min.js?compression=brotli&label=popper%20base)
|
||||
|
||||
## Hacking the library
|
||||
|
||||
If you want to play with the library, implement new features, fix a bug you
|
||||
found, or simply experiment with it, this section is for you!
|
||||
|
||||
First of all, make sure to have
|
||||
[Yarn installed](https://yarnpkg.com/lang/en/docs/install).
|
||||
|
||||
Install the development dependencies:
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
And run the development environment:
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
```
|
||||
|
||||
Then, simply open one the development server web page:
|
||||
|
||||
```bash
|
||||
# macOS and Linux
|
||||
open localhost:5000
|
||||
|
||||
# Windows
|
||||
start localhost:5000
|
||||
```
|
||||
|
||||
From there, you can open any of the examples (`.html` files) to fiddle with
|
||||
them.
|
||||
|
||||
Now any change you will made to the source code, will be automatically compiled,
|
||||
you just need to refresh the page.
|
||||
|
||||
If the page is not working properly, try to go in _"Developer Tools >
|
||||
Application > Clear storage"_ and click on "_Clear site data_".
|
||||
To run the examples you need a browser with
|
||||
[JavaScript modules via script tag support](https://caniuse.com/#feat=es6-module).
|
||||
|
||||
## Test Suite
|
||||
|
||||
Popper is currently tested with unit tests, and functional tests. Both of them
|
||||
are run by Jest.
|
||||
|
||||
### Unit Tests
|
||||
|
||||
The unit tests use JSDOM to provide a primitive document object API, they are
|
||||
used to ensure the utility functions behave as expected in isolation.
|
||||
|
||||
### Functional Tests
|
||||
|
||||
The functional tests run with Puppeteer, to take advantage of a complete browser
|
||||
environment. They are currently running on Chromium, and Firefox.
|
||||
|
||||
You can run them with `yarn test:functional`. Set the `PUPPETEER_BROWSER`
|
||||
environment variable to `firefox` to run them on the Mozilla browser.
|
||||
|
||||
The assertions are written in form of image snapshots, so that it's easy to
|
||||
assert for the correct Popper behavior without having to write a lot of offsets
|
||||
comparisons manually.
|
||||
|
||||
You can mark a `*.test.js` file to run in the Puppeteer environment by
|
||||
prepending a `@jest-environment puppeteer` JSDoc comment to the interested file.
|
||||
|
||||
Here's an example of a basic functional test:
|
||||
|
||||
```js
|
||||
/**
|
||||
* @jest-environment puppeteer
|
||||
* @flow
|
||||
*/
|
||||
import { screenshot } from '../utils/puppeteer.js';
|
||||
|
||||
it('should position the popper on the right', async () => {
|
||||
const page = await browser.newPage();
|
||||
await page.goto(`${TEST_URL}/basic.html`);
|
||||
|
||||
expect(await screenshot(page)).toMatchImageSnapshot();
|
||||
});
|
||||
```
|
||||
|
||||
You can find the complete
|
||||
[`jest-puppeteer` documentation here](https://github.com/smooth-code/jest-puppeteer#api),
|
||||
and the
|
||||
[`jest-image-snapshot` documentation here](https://github.com/americanexpress/jest-image-snapshot#%EF%B8%8F-api).
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* @popperjs/core v2.11.4 - MIT License
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var top = 'top';
|
||||
var bottom = 'bottom';
|
||||
var right = 'right';
|
||||
var left = 'left';
|
||||
var auto = 'auto';
|
||||
var basePlacements = [top, bottom, right, left];
|
||||
var start = 'start';
|
||||
var end = 'end';
|
||||
var clippingParents = 'clippingParents';
|
||||
var viewport = 'viewport';
|
||||
var popper = 'popper';
|
||||
var reference = 'reference';
|
||||
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
||||
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
||||
}, []);
|
||||
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
||||
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
||||
}, []); // modifiers that need to read the DOM
|
||||
|
||||
var beforeRead = 'beforeRead';
|
||||
var read = 'read';
|
||||
var afterRead = 'afterRead'; // pure-logic modifiers
|
||||
|
||||
var beforeMain = 'beforeMain';
|
||||
var main = 'main';
|
||||
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
||||
|
||||
var beforeWrite = 'beforeWrite';
|
||||
var write = 'write';
|
||||
var afterWrite = 'afterWrite';
|
||||
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
||||
|
||||
exports.afterMain = afterMain;
|
||||
exports.afterRead = afterRead;
|
||||
exports.afterWrite = afterWrite;
|
||||
exports.auto = auto;
|
||||
exports.basePlacements = basePlacements;
|
||||
exports.beforeMain = beforeMain;
|
||||
exports.beforeRead = beforeRead;
|
||||
exports.beforeWrite = beforeWrite;
|
||||
exports.bottom = bottom;
|
||||
exports.clippingParents = clippingParents;
|
||||
exports.end = end;
|
||||
exports.left = left;
|
||||
exports.main = main;
|
||||
exports.modifierPhases = modifierPhases;
|
||||
exports.placements = placements;
|
||||
exports.popper = popper;
|
||||
exports.read = read;
|
||||
exports.reference = reference;
|
||||
exports.right = right;
|
||||
exports.start = start;
|
||||
exports.top = top;
|
||||
exports.variationPlacements = variationPlacements;
|
||||
exports.viewport = viewport;
|
||||
exports.write = write;
|
||||
//# sourceMappingURL=enums.js.map
|
|
@ -1,3 +0,0 @@
|
|||
// @flow
|
||||
|
||||
export * from '../../lib/enums.js'
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"enums.js","sources":["../../src/enums.js"],"sourcesContent":["// @flow\nexport const top: 'top' = 'top';\nexport const bottom: 'bottom' = 'bottom';\nexport const right: 'right' = 'right';\nexport const left: 'left' = 'left';\nexport const auto: 'auto' = 'auto';\nexport type BasePlacement =\n | typeof top\n | typeof bottom\n | typeof right\n | typeof left;\nexport const basePlacements: Array<BasePlacement> = [top, bottom, right, left];\n\nexport const start: 'start' = 'start';\nexport const end: 'end' = 'end';\nexport type Variation = typeof start | typeof end;\n\nexport const clippingParents: 'clippingParents' = 'clippingParents';\nexport const viewport: 'viewport' = 'viewport';\nexport type Boundary = Element | Array<Element> | typeof clippingParents;\nexport type RootBoundary = typeof viewport | 'document';\n\nexport const popper: 'popper' = 'popper';\nexport const reference: 'reference' = 'reference';\nexport type Context = typeof popper | typeof reference;\n\nexport type VariationPlacement =\n | 'top-start'\n | 'top-end'\n | 'bottom-start'\n | 'bottom-end'\n | 'right-start'\n | 'right-end'\n | 'left-start'\n | 'left-end';\nexport type AutoPlacement = 'auto' | 'auto-start' | 'auto-end';\nexport type ComputedPlacement = VariationPlacement | BasePlacement;\nexport type Placement = AutoPlacement | BasePlacement | VariationPlacement;\n\nexport const variationPlacements: Array<VariationPlacement> = basePlacements.reduce(\n (acc: Array<VariationPlacement>, placement: BasePlacement) =>\n acc.concat([(`${placement}-${start}`: any), (`${placement}-${end}`: any)]),\n []\n);\nexport const placements: Array<Placement> = [...basePlacements, auto].reduce(\n (\n acc: Array<Placement>,\n placement: BasePlacement | typeof auto\n ): Array<Placement> =>\n acc.concat([\n placement,\n (`${placement}-${start}`: any),\n (`${placement}-${end}`: any),\n ]),\n []\n);\n\n// modifiers that need to read the DOM\nexport const beforeRead: 'beforeRead' = 'beforeRead';\nexport const read: 'read' = 'read';\nexport const afterRead: 'afterRead' = 'afterRead';\n// pure-logic modifiers\nexport const beforeMain: 'beforeMain' = 'beforeMain';\nexport const main: 'main' = 'main';\nexport const afterMain: 'afterMain' = 'afterMain';\n// modifier with the purpose to write to the DOM (or write into a framework state)\nexport const beforeWrite: 'beforeWrite' = 'beforeWrite';\nexport const write: 'write' = 'write';\nexport const afterWrite: 'afterWrite' = 'afterWrite';\nexport const modifierPhases: Array<ModifierPhases> = [\n beforeRead,\n read,\n afterRead,\n beforeMain,\n main,\n afterMain,\n beforeWrite,\n write,\n afterWrite,\n];\n\nexport type ModifierPhases =\n | typeof beforeRead\n | typeof read\n | typeof afterRead\n | typeof beforeMain\n | typeof main\n | typeof afterMain\n | typeof beforeWrite\n | typeof write\n | typeof afterWrite;\n"],"names":["top","bottom","right","left","auto","basePlacements","start","end","clippingParents","viewport","popper","reference","variationPlacements","reduce","acc","placement","concat","placements","beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite","modifierPhases"],"mappings":";;;;;;;;IACaA,GAAU,GAAG;IACbC,MAAgB,GAAG;IACnBC,KAAc,GAAG;IACjBC,IAAY,GAAG;IACfC,IAAY,GAAG;IAMfC,cAAoC,GAAG,CAACL,GAAD,EAAMC,MAAN,EAAcC,KAAd,EAAqBC,IAArB;IAEvCG,KAAc,GAAG;IACjBC,GAAU,GAAG;IAGbC,eAAkC,GAAG;IACrCC,QAAoB,GAAG;IAIvBC,MAAgB,GAAG;IACnBC,SAAsB,GAAG;IAgBzBC,mBAA8C,gBAAGP,cAAc,CAACQ,MAAf,CAC5D,UAACC,GAAD,EAAiCC,SAAjC;AAAA,SACED,GAAG,CAACE,MAAJ,CAAW,CAAKD,SAAL,SAAkBT,KAAlB,EAAqCS,SAArC,SAAkDR,GAAlD,CAAX,CADF;AAAA,CAD4D,EAG5D,EAH4D;IAKjDU,UAA4B,gBAAG,UAAIZ,cAAJ,GAAoBD,IAApB,GAA0BS,MAA1B,CAC1C,UACEC,GADF,EAEEC,SAFF;AAAA,SAIED,GAAG,CAACE,MAAJ,CAAW,CACTD,SADS,EAELA,SAFK,SAEQT,KAFR,EAGLS,SAHK,SAGQR,GAHR,CAAX,CAJF;AAAA,CAD0C,EAU1C,EAV0C;;IAc/BW,UAAwB,GAAG;IAC3BC,IAAY,GAAG;IACfC,SAAsB,GAAG;;IAEzBC,UAAwB,GAAG;IAC3BC,IAAY,GAAG;IACfC,SAAsB,GAAG;;IAEzBC,WAA0B,GAAG;IAC7BC,KAAc,GAAG;IACjBC,UAAwB,GAAG;IAC3BC,cAAqC,GAAG,CACnDT,UADmD,EAEnDC,IAFmD,EAGnDC,SAHmD,EAInDC,UAJmD,EAKnDC,IALmD,EAMnDC,SANmD,EAOnDC,WAPmD,EAQnDC,KARmD,EASnDC,UATmD;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +0,0 @@
|
|||
// @flow
|
||||
|
||||
export * from '../../lib/popper-base.js'
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +0,0 @@
|
|||
// @flow
|
||||
|
||||
export * from '../../lib/popper-lite.js'
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +0,0 @@
|
|||
// @flow
|
||||
|
||||
export * from '../../lib/popper.js'
|
File diff suppressed because one or more lines are too long
|
@ -1,259 +0,0 @@
|
|||
import getCompositeRect from "./dom-utils/getCompositeRect.js";
|
||||
import getLayoutRect from "./dom-utils/getLayoutRect.js";
|
||||
import listScrollParents from "./dom-utils/listScrollParents.js";
|
||||
import getOffsetParent from "./dom-utils/getOffsetParent.js";
|
||||
import getComputedStyle from "./dom-utils/getComputedStyle.js";
|
||||
import orderModifiers from "./utils/orderModifiers.js";
|
||||
import debounce from "./utils/debounce.js";
|
||||
import validateModifiers from "./utils/validateModifiers.js";
|
||||
import uniqueBy from "./utils/uniqueBy.js";
|
||||
import getBasePlacement from "./utils/getBasePlacement.js";
|
||||
import mergeByName from "./utils/mergeByName.js";
|
||||
import detectOverflow from "./utils/detectOverflow.js";
|
||||
import { isElement } from "./dom-utils/instanceOf.js";
|
||||
import { auto } from "./enums.js";
|
||||
var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
|
||||
var INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';
|
||||
var DEFAULT_OPTIONS = {
|
||||
placement: 'bottom',
|
||||
modifiers: [],
|
||||
strategy: 'absolute'
|
||||
};
|
||||
|
||||
function areValidElements() {
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return !args.some(function (element) {
|
||||
return !(element && typeof element.getBoundingClientRect === 'function');
|
||||
});
|
||||
}
|
||||
|
||||
export function popperGenerator(generatorOptions) {
|
||||
if (generatorOptions === void 0) {
|
||||
generatorOptions = {};
|
||||
}
|
||||
|
||||
var _generatorOptions = generatorOptions,
|
||||
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
||||
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
||||
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
||||
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
||||
return function createPopper(reference, popper, options) {
|
||||
if (options === void 0) {
|
||||
options = defaultOptions;
|
||||
}
|
||||
|
||||
var state = {
|
||||
placement: 'bottom',
|
||||
orderedModifiers: [],
|
||||
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
||||
modifiersData: {},
|
||||
elements: {
|
||||
reference: reference,
|
||||
popper: popper
|
||||
},
|
||||
attributes: {},
|
||||
styles: {}
|
||||
};
|
||||
var effectCleanupFns = [];
|
||||
var isDestroyed = false;
|
||||
var instance = {
|
||||
state: state,
|
||||
setOptions: function setOptions(setOptionsAction) {
|
||||
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
||||
cleanupModifierEffects();
|
||||
state.options = Object.assign({}, defaultOptions, state.options, options);
|
||||
state.scrollParents = {
|
||||
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
||||
popper: listScrollParents(popper)
|
||||
}; // Orders the modifiers based on their dependencies and `phase`
|
||||
// properties
|
||||
|
||||
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
||||
|
||||
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
||||
return m.enabled;
|
||||
}); // Validate the provided modifiers so that the consumer will get warned
|
||||
// if one of the modifiers is invalid for any reason
|
||||
|
||||
if (false) {
|
||||
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {
|
||||
var name = _ref.name;
|
||||
return name;
|
||||
});
|
||||
validateModifiers(modifiers);
|
||||
|
||||
if (getBasePlacement(state.options.placement) === auto) {
|
||||
var flipModifier = state.orderedModifiers.find(function (_ref2) {
|
||||
var name = _ref2.name;
|
||||
return name === 'flip';
|
||||
});
|
||||
|
||||
if (!flipModifier) {
|
||||
console.error(['Popper: "auto" placements require the "flip" modifier be', 'present and enabled to work.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
var _getComputedStyle = getComputedStyle(popper),
|
||||
marginTop = _getComputedStyle.marginTop,
|
||||
marginRight = _getComputedStyle.marginRight,
|
||||
marginBottom = _getComputedStyle.marginBottom,
|
||||
marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can
|
||||
// cause bugs with positioning, so we'll warn the consumer
|
||||
|
||||
|
||||
if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {
|
||||
return parseFloat(margin);
|
||||
})) {
|
||||
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
runModifierEffects();
|
||||
return instance.update();
|
||||
},
|
||||
// Sync update – it will always be executed, even if not necessary. This
|
||||
// is useful for low frequency updates where sync behavior simplifies the
|
||||
// logic.
|
||||
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
||||
// prefer the async Popper#update method
|
||||
forceUpdate: function forceUpdate() {
|
||||
if (isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
var _state$elements = state.elements,
|
||||
reference = _state$elements.reference,
|
||||
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
||||
// anymore
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
if (false) {
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return;
|
||||
} // Store the reference and popper rects to be read by modifiers
|
||||
|
||||
|
||||
state.rects = {
|
||||
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
||||
popper: getLayoutRect(popper)
|
||||
}; // Modifiers have the ability to reset the current update cycle. The
|
||||
// most common use case for this is the `flip` modifier changing the
|
||||
// placement, which then needs to re-run all the modifiers, because the
|
||||
// logic was previously ran for the previous placement and is therefore
|
||||
// stale/incorrect
|
||||
|
||||
state.reset = false;
|
||||
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
||||
// is filled with the initial data specified by the modifier. This means
|
||||
// it doesn't persist and is fresh on each update.
|
||||
// To ensure persistent data, use `${name}#persistent`
|
||||
|
||||
state.orderedModifiers.forEach(function (modifier) {
|
||||
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
||||
});
|
||||
var __debug_loops__ = 0;
|
||||
|
||||
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
||||
if (false) {
|
||||
__debug_loops__ += 1;
|
||||
|
||||
if (__debug_loops__ > 100) {
|
||||
console.error(INFINITE_LOOP_ERROR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state.reset === true) {
|
||||
state.reset = false;
|
||||
index = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
var _state$orderedModifie = state.orderedModifiers[index],
|
||||
fn = _state$orderedModifie.fn,
|
||||
_state$orderedModifie2 = _state$orderedModifie.options,
|
||||
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
||||
name = _state$orderedModifie.name;
|
||||
|
||||
if (typeof fn === 'function') {
|
||||
state = fn({
|
||||
state: state,
|
||||
options: _options,
|
||||
name: name,
|
||||
instance: instance
|
||||
}) || state;
|
||||
}
|
||||
}
|
||||
},
|
||||
// Async and optimistically optimized update – it will not be executed if
|
||||
// not necessary (debounced to run at most once-per-tick)
|
||||
update: debounce(function () {
|
||||
return new Promise(function (resolve) {
|
||||
instance.forceUpdate();
|
||||
resolve(state);
|
||||
});
|
||||
}),
|
||||
destroy: function destroy() {
|
||||
cleanupModifierEffects();
|
||||
isDestroyed = true;
|
||||
}
|
||||
};
|
||||
|
||||
if (!areValidElements(reference, popper)) {
|
||||
if (false) {
|
||||
console.error(INVALID_ELEMENT_ERROR);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
instance.setOptions(options).then(function (state) {
|
||||
if (!isDestroyed && options.onFirstUpdate) {
|
||||
options.onFirstUpdate(state);
|
||||
}
|
||||
}); // Modifiers have the ability to execute arbitrary code before the first
|
||||
// update cycle runs. They will be executed in the same order as the update
|
||||
// cycle. This is useful when a modifier adds some persistent data that
|
||||
// other modifiers need to use, but the modifier is run after the dependent
|
||||
// one.
|
||||
|
||||
function runModifierEffects() {
|
||||
state.orderedModifiers.forEach(function (_ref3) {
|
||||
var name = _ref3.name,
|
||||
_ref3$options = _ref3.options,
|
||||
options = _ref3$options === void 0 ? {} : _ref3$options,
|
||||
effect = _ref3.effect;
|
||||
|
||||
if (typeof effect === 'function') {
|
||||
var cleanupFn = effect({
|
||||
state: state,
|
||||
name: name,
|
||||
instance: instance,
|
||||
options: options
|
||||
});
|
||||
|
||||
var noopFn = function noopFn() {};
|
||||
|
||||
effectCleanupFns.push(cleanupFn || noopFn);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cleanupModifierEffects() {
|
||||
effectCleanupFns.forEach(function (fn) {
|
||||
return fn();
|
||||
});
|
||||
effectCleanupFns = [];
|
||||
}
|
||||
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
export var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules
|
||||
|
||||
export { detectOverflow };
|
|
@ -1,23 +0,0 @@
|
|||
import { isShadowRoot } from "./instanceOf.js";
|
||||
export default function contains(parent, child) {
|
||||
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
||||
|
||||
if (parent.contains(child)) {
|
||||
return true;
|
||||
} // then fallback to custom implementation with Shadow DOM support
|
||||
else if (rootNode && isShadowRoot(rootNode)) {
|
||||
var next = child;
|
||||
|
||||
do {
|
||||
if (next && parent.isSameNode(next)) {
|
||||
return true;
|
||||
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
||||
|
||||
|
||||
next = next.parentNode || next.host;
|
||||
} while (next);
|
||||
} // Give up, the result is false
|
||||
|
||||
|
||||
return false;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
import { isHTMLElement } from "./instanceOf.js";
|
||||
import { round } from "../utils/math.js";
|
||||
export default function getBoundingClientRect(element, includeScale) {
|
||||
if (includeScale === void 0) {
|
||||
includeScale = false;
|
||||
}
|
||||
|
||||
var rect = element.getBoundingClientRect();
|
||||
var scaleX = 1;
|
||||
var scaleY = 1;
|
||||
|
||||
if (isHTMLElement(element) && includeScale) {
|
||||
var offsetHeight = element.offsetHeight;
|
||||
var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
|
||||
// Fallback to 1 in case both values are `0`
|
||||
|
||||
if (offsetWidth > 0) {
|
||||
scaleX = round(rect.width) / offsetWidth || 1;
|
||||
}
|
||||
|
||||
if (offsetHeight > 0) {
|
||||
scaleY = round(rect.height) / offsetHeight || 1;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
width: rect.width / scaleX,
|
||||
height: rect.height / scaleY,
|
||||
top: rect.top / scaleY,
|
||||
right: rect.right / scaleX,
|
||||
bottom: rect.bottom / scaleY,
|
||||
left: rect.left / scaleX,
|
||||
x: rect.left / scaleX,
|
||||
y: rect.top / scaleY
|
||||
};
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
import { viewport } from "../enums.js";
|
||||
import getViewportRect from "./getViewportRect.js";
|
||||
import getDocumentRect from "./getDocumentRect.js";
|
||||
import listScrollParents from "./listScrollParents.js";
|
||||
import getOffsetParent from "./getOffsetParent.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getComputedStyle from "./getComputedStyle.js";
|
||||
import { isElement, isHTMLElement } from "./instanceOf.js";
|
||||
import getBoundingClientRect from "./getBoundingClientRect.js";
|
||||
import getParentNode from "./getParentNode.js";
|
||||
import contains from "./contains.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import rectToClientRect from "../utils/rectToClientRect.js";
|
||||
import { max, min } from "../utils/math.js";
|
||||
|
||||
function getInnerBoundingClientRect(element) {
|
||||
var rect = getBoundingClientRect(element);
|
||||
rect.top = rect.top + element.clientTop;
|
||||
rect.left = rect.left + element.clientLeft;
|
||||
rect.bottom = rect.top + element.clientHeight;
|
||||
rect.right = rect.left + element.clientWidth;
|
||||
rect.width = element.clientWidth;
|
||||
rect.height = element.clientHeight;
|
||||
rect.x = rect.left;
|
||||
rect.y = rect.top;
|
||||
return rect;
|
||||
}
|
||||
|
||||
function getClientRectFromMixedType(element, clippingParent) {
|
||||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||||
} // A "clipping parent" is an overflowable container with the characteristic of
|
||||
// clipping (or hiding) overflowing elements with a position different from
|
||||
// `initial`
|
||||
|
||||
|
||||
function getClippingParents(element) {
|
||||
var clippingParents = listScrollParents(getParentNode(element));
|
||||
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
|
||||
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
||||
|
||||
if (!isElement(clipperElement)) {
|
||||
return [];
|
||||
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
||||
|
||||
|
||||
return clippingParents.filter(function (clippingParent) {
|
||||
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
||||
});
|
||||
} // Gets the maximum area that the element is visible in due to any number of
|
||||
// clipping parents
|
||||
|
||||
|
||||
export default function getClippingRect(element, boundary, rootBoundary) {
|
||||
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
||||
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
||||
var firstClippingParent = clippingParents[0];
|
||||
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
||||
var rect = getClientRectFromMixedType(element, clippingParent);
|
||||
accRect.top = max(rect.top, accRect.top);
|
||||
accRect.right = min(rect.right, accRect.right);
|
||||
accRect.bottom = min(rect.bottom, accRect.bottom);
|
||||
accRect.left = max(rect.left, accRect.left);
|
||||
return accRect;
|
||||
}, getClientRectFromMixedType(element, firstClippingParent));
|
||||
clippingRect.width = clippingRect.right - clippingRect.left;
|
||||
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
||||
clippingRect.x = clippingRect.left;
|
||||
clippingRect.y = clippingRect.top;
|
||||
return clippingRect;
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
import getBoundingClientRect from "./getBoundingClientRect.js";
|
||||
import getNodeScroll from "./getNodeScroll.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import isScrollParent from "./isScrollParent.js";
|
||||
import { round } from "../utils/math.js";
|
||||
|
||||
function isElementScaled(element) {
|
||||
var rect = element.getBoundingClientRect();
|
||||
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
||||
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
||||
return scaleX !== 1 || scaleY !== 1;
|
||||
} // Returns the composite rect of an element relative to its offsetParent.
|
||||
// Composite means it takes into account transforms as well as layout.
|
||||
|
||||
|
||||
export default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||||
if (isFixed === void 0) {
|
||||
isFixed = false;
|
||||
}
|
||||
|
||||
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||||
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
||||
var documentElement = getDocumentElement(offsetParent);
|
||||
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
||||
var scroll = {
|
||||
scrollLeft: 0,
|
||||
scrollTop: 0
|
||||
};
|
||||
var offsets = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||||
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
||||
isScrollParent(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
|
||||
if (isHTMLElement(offsetParent)) {
|
||||
offsets = getBoundingClientRect(offsetParent, true);
|
||||
offsets.x += offsetParent.clientLeft;
|
||||
offsets.y += offsetParent.clientTop;
|
||||
} else if (documentElement) {
|
||||
offsets.x = getWindowScrollBarX(documentElement);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
x: rect.left + scroll.scrollLeft - offsets.x,
|
||||
y: rect.top + scroll.scrollTop - offsets.y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
import getWindow from "./getWindow.js";
|
||||
export default function getComputedStyle(element) {
|
||||
return getWindow(element).getComputedStyle(element);
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
import { isElement } from "./instanceOf.js";
|
||||
export default function getDocumentElement(element) {
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
||||
element.document) || window.document).documentElement;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getComputedStyle from "./getComputedStyle.js";
|
||||
import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
||||
import getWindowScroll from "./getWindowScroll.js";
|
||||
import { max } from "../utils/math.js"; // Gets the entire size of the scrollable document area, even extending outside
|
||||
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
||||
|
||||
export default function getDocumentRect(element) {
|
||||
var _element$ownerDocumen;
|
||||
|
||||
var html = getDocumentElement(element);
|
||||
var winScroll = getWindowScroll(element);
|
||||
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
||||
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||||
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||||
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
||||
var y = -winScroll.scrollTop;
|
||||
|
||||
if (getComputedStyle(body || html).direction === 'rtl') {
|
||||
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||||
}
|
||||
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
export default function getHTMLElementScroll(element) {
|
||||
return {
|
||||
scrollLeft: element.scrollLeft,
|
||||
scrollTop: element.scrollTop
|
||||
};
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
import getBoundingClientRect from "./getBoundingClientRect.js"; // Returns the layout rect of an element relative to its offsetParent. Layout
|
||||
// means it doesn't take into account transforms.
|
||||
|
||||
export default function getLayoutRect(element) {
|
||||
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
||||
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
||||
|
||||
var width = element.offsetWidth;
|
||||
var height = element.offsetHeight;
|
||||
|
||||
if (Math.abs(clientRect.width - width) <= 1) {
|
||||
width = clientRect.width;
|
||||
}
|
||||
|
||||
if (Math.abs(clientRect.height - height) <= 1) {
|
||||
height = clientRect.height;
|
||||
}
|
||||
|
||||
return {
|
||||
x: element.offsetLeft,
|
||||
y: element.offsetTop,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
export default function getNodeName(element) {
|
||||
return element ? (element.nodeName || '').toLowerCase() : null;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
import getWindowScroll from "./getWindowScroll.js";
|
||||
import getWindow from "./getWindow.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
import getHTMLElementScroll from "./getHTMLElementScroll.js";
|
||||
export default function getNodeScroll(node) {
|
||||
if (node === getWindow(node) || !isHTMLElement(node)) {
|
||||
return getWindowScroll(node);
|
||||
} else {
|
||||
return getHTMLElementScroll(node);
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
import getWindow from "./getWindow.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import getComputedStyle from "./getComputedStyle.js";
|
||||
import { isHTMLElement, isShadowRoot } from "./instanceOf.js";
|
||||
import isTableElement from "./isTableElement.js";
|
||||
import getParentNode from "./getParentNode.js";
|
||||
|
||||
function getTrueOffsetParent(element) {
|
||||
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
||||
getComputedStyle(element).position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return element.offsetParent;
|
||||
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
||||
// return the containing block
|
||||
|
||||
|
||||
function getContainingBlock(element) {
|
||||
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
|
||||
var isIE = navigator.userAgent.indexOf('Trident') !== -1;
|
||||
|
||||
if (isIE && isHTMLElement(element)) {
|
||||
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
||||
var elementCss = getComputedStyle(element);
|
||||
|
||||
if (elementCss.position === 'fixed') {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var currentNode = getParentNode(element);
|
||||
|
||||
if (isShadowRoot(currentNode)) {
|
||||
currentNode = currentNode.host;
|
||||
}
|
||||
|
||||
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
||||
var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
||||
// create a containing block.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
||||
|
||||
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
||||
return currentNode;
|
||||
} else {
|
||||
currentNode = currentNode.parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
||||
// such as table ancestors and cross browser bugs.
|
||||
|
||||
|
||||
export default function getOffsetParent(element) {
|
||||
var window = getWindow(element);
|
||||
var offsetParent = getTrueOffsetParent(element);
|
||||
|
||||
while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
|
||||
offsetParent = getTrueOffsetParent(offsetParent);
|
||||
}
|
||||
|
||||
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
|
||||
return window;
|
||||
}
|
||||
|
||||
return offsetParent || getContainingBlock(element) || window;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
import getNodeName from "./getNodeName.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import { isShadowRoot } from "./instanceOf.js";
|
||||
export default function getParentNode(element) {
|
||||
if (getNodeName(element) === 'html') {
|
||||
return element;
|
||||
}
|
||||
|
||||
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
||||
// $FlowFixMe[incompatible-return]
|
||||
// $FlowFixMe[prop-missing]
|
||||
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
||||
element.parentNode || ( // DOM Element detected
|
||||
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
||||
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
||||
getDocumentElement(element) // fallback
|
||||
|
||||
);
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import getParentNode from "./getParentNode.js";
|
||||
import isScrollParent from "./isScrollParent.js";
|
||||
import getNodeName from "./getNodeName.js";
|
||||
import { isHTMLElement } from "./instanceOf.js";
|
||||
export default function getScrollParent(node) {
|
||||
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
||||
// $FlowFixMe[incompatible-return]: assume body is always available
|
||||
return node.ownerDocument.body;
|
||||
}
|
||||
|
||||
if (isHTMLElement(node) && isScrollParent(node)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
return getScrollParent(getParentNode(node));
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
import getWindow from "./getWindow.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
||||
export default function getViewportRect(element) {
|
||||
var win = getWindow(element);
|
||||
var html = getDocumentElement(element);
|
||||
var visualViewport = win.visualViewport;
|
||||
var width = html.clientWidth;
|
||||
var height = html.clientHeight;
|
||||
var x = 0;
|
||||
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
|
||||
// can be obscured underneath it.
|
||||
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
|
||||
// if it isn't open, so if this isn't available, the popper will be detected
|
||||
// to overflow the bottom of the screen too early.
|
||||
|
||||
if (visualViewport) {
|
||||
width = visualViewport.width;
|
||||
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
|
||||
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
|
||||
// errors due to floating point numbers, so we need to check precision.
|
||||
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
|
||||
// Feature detection fails in mobile emulation mode in Chrome.
|
||||
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
|
||||
// 0.001
|
||||
// Fallback here: "Not Safari" userAgent
|
||||
|
||||
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
||||
x = visualViewport.offsetLeft;
|
||||
y = visualViewport.offsetTop;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x + getWindowScrollBarX(element),
|
||||
y: y
|
||||
};
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
export default function getWindow(node) {
|
||||
if (node == null) {
|
||||
return window;
|
||||
}
|
||||
|
||||
if (node.toString() !== '[object Window]') {
|
||||
var ownerDocument = node.ownerDocument;
|
||||
return ownerDocument ? ownerDocument.defaultView || window : window;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
import getWindow from "./getWindow.js";
|
||||
export default function getWindowScroll(node) {
|
||||
var win = getWindow(node);
|
||||
var scrollLeft = win.pageXOffset;
|
||||
var scrollTop = win.pageYOffset;
|
||||
return {
|
||||
scrollLeft: scrollLeft,
|
||||
scrollTop: scrollTop
|
||||
};
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
import getBoundingClientRect from "./getBoundingClientRect.js";
|
||||
import getDocumentElement from "./getDocumentElement.js";
|
||||
import getWindowScroll from "./getWindowScroll.js";
|
||||
export default function getWindowScrollBarX(element) {
|
||||
// If <html> has a CSS width greater than the viewport, then this will be
|
||||
// incorrect for RTL.
|
||||
// Popper 1 is broken in this case and never had a bug report so let's assume
|
||||
// it's not an issue. I don't think anyone ever specifies width on <html>
|
||||
// anyway.
|
||||
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
||||
// this (e.g. Edge 2019, IE11, Safari)
|
||||
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
import getWindow from "./getWindow.js";
|
||||
|
||||
function isElement(node) {
|
||||
var OwnElement = getWindow(node).Element;
|
||||
return node instanceof OwnElement || node instanceof Element;
|
||||
}
|
||||
|
||||
function isHTMLElement(node) {
|
||||
var OwnElement = getWindow(node).HTMLElement;
|
||||
return node instanceof OwnElement || node instanceof HTMLElement;
|
||||
}
|
||||
|
||||
function isShadowRoot(node) {
|
||||
// IE 11 has no ShadowRoot
|
||||
if (typeof ShadowRoot === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var OwnElement = getWindow(node).ShadowRoot;
|
||||
return node instanceof OwnElement || node instanceof ShadowRoot;
|
||||
}
|
||||
|
||||
export { isElement, isHTMLElement, isShadowRoot };
|
|
@ -1,10 +0,0 @@
|
|||
import getComputedStyle from "./getComputedStyle.js";
|
||||
export default function isScrollParent(element) {
|
||||
// Firefox wants us to check `-x` and `-y` variations as well
|
||||
var _getComputedStyle = getComputedStyle(element),
|
||||
overflow = _getComputedStyle.overflow,
|
||||
overflowX = _getComputedStyle.overflowX,
|
||||
overflowY = _getComputedStyle.overflowY;
|
||||
|
||||
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
import getNodeName from "./getNodeName.js";
|
||||
export default function isTableElement(element) {
|
||||
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue