From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/clipboardy/fallbacks/linux/xsel | Bin 0 -> 129416 bytes node_modules/clipboardy/index.js | 41 +++++++++++++++++ node_modules/clipboardy/lib/linux.js | 48 ++++++++++++++++++++ node_modules/clipboardy/lib/macos.js | 11 +++++ node_modules/clipboardy/lib/termux.js | 29 ++++++++++++ node_modules/clipboardy/lib/windows.js | 16 +++++++ node_modules/clipboardy/license | 9 ++++ node_modules/clipboardy/package.json | 44 ++++++++++++++++++ node_modules/clipboardy/readme.md | 64 +++++++++++++++++++++++++++ 9 files changed, 262 insertions(+) create mode 100755 node_modules/clipboardy/fallbacks/linux/xsel create mode 100644 node_modules/clipboardy/index.js create mode 100644 node_modules/clipboardy/lib/linux.js create mode 100644 node_modules/clipboardy/lib/macos.js create mode 100644 node_modules/clipboardy/lib/termux.js create mode 100644 node_modules/clipboardy/lib/windows.js create mode 100644 node_modules/clipboardy/license create mode 100644 node_modules/clipboardy/package.json create mode 100644 node_modules/clipboardy/readme.md (limited to 'node_modules/clipboardy') diff --git a/node_modules/clipboardy/fallbacks/linux/xsel b/node_modules/clipboardy/fallbacks/linux/xsel new file mode 100755 index 00000000..a6b2fd3d Binary files /dev/null and b/node_modules/clipboardy/fallbacks/linux/xsel differ diff --git a/node_modules/clipboardy/index.js b/node_modules/clipboardy/index.js new file mode 100644 index 00000000..d6132fce --- /dev/null +++ b/node_modules/clipboardy/index.js @@ -0,0 +1,41 @@ +'use strict'; +const termux = require('./lib/termux.js'); +const linux = require('./lib/linux.js'); +const macos = require('./lib/macos.js'); +const windows = require('./lib/windows.js'); + +function platform() { + switch (process.platform) { + case 'darwin': + return macos; + case 'win32': + return windows; + case 'android': + if (process.env.PREFIX !== '/data/data/com.termux/files/usr') { + throw new Error('You need to install Termux for this module to work on Android: https://termux.com'); + } + return termux; + default: + return linux; + } +} + +exports.write = input => { + if (typeof input !== 'string') { + return Promise.reject(new TypeError(`Expected a string, got ${typeof input}`)); + } + + return platform().copy({input}).then(() => {}); +}; + +exports.read = () => platform().paste({stripEof: false}); + +exports.writeSync = input => { + if (typeof input !== 'string') { + throw new TypeError(`Expected a string, got ${typeof input}`); + } + + platform().copySync({input}); +}; + +exports.readSync = () => platform().pasteSync({stripEof: false}).stdout; diff --git a/node_modules/clipboardy/lib/linux.js b/node_modules/clipboardy/lib/linux.js new file mode 100644 index 00000000..a93cbf60 --- /dev/null +++ b/node_modules/clipboardy/lib/linux.js @@ -0,0 +1,48 @@ +'use strict'; +const path = require('path'); +const execa = require('execa'); + +const handler = err => { + if (err.code === 'ENOENT') { + throw new Error('Couldn\'t find the required `xsel` binary. On Debian/Ubuntu you can install it with: sudo apt install xsel'); + } + + throw err; +}; + +const xsel = path.join(__dirname, '../fallbacks/linux/xsel'); + +module.exports = { + copy: opts => { + return execa(xsel, ['--clipboard', '--input'], opts) + .catch(() => execa('xsel', ['--clipboard', '--input'], opts)) + .catch(handler); + }, + paste: opts => { + return execa.stdout(xsel, ['--clipboard', '--output'], opts) + .catch(() => execa.stdout('xsel', ['--clipboard', '--output'], opts)) + .catch(handler); + }, + copySync: opts => { + try { + return execa.sync(xsel, ['--clipboard', '--input'], opts); + } catch (err) { + try { + return execa.sync('xsel', ['--clipboard', '--input'], opts); + } catch (err) { + handler(err); + } + } + }, + pasteSync: opts => { + try { + return execa.sync(xsel, ['--clipboard', '--output'], opts); + } catch (err) { + try { + return execa.sync('xsel', ['--clipboard', '--output'], opts); + } catch (err) { + handler(err); + } + } + } +}; diff --git a/node_modules/clipboardy/lib/macos.js b/node_modules/clipboardy/lib/macos.js new file mode 100644 index 00000000..d25305b4 --- /dev/null +++ b/node_modules/clipboardy/lib/macos.js @@ -0,0 +1,11 @@ +'use strict'; +const execa = require('execa'); + +const env = Object.assign({}, process.env, {LC_CTYPE: 'UTF-8'}); + +module.exports = { + copy: opts => execa('pbcopy', Object.assign({}, opts, {env})), + paste: opts => execa.stdout('pbpaste', Object.assign({}, opts, {env})), + copySync: opts => execa.sync('pbcopy', Object.assign({}, opts, {env})), + pasteSync: opts => execa.sync('pbpaste', Object.assign({}, opts, {env})) +}; diff --git a/node_modules/clipboardy/lib/termux.js b/node_modules/clipboardy/lib/termux.js new file mode 100644 index 00000000..67050193 --- /dev/null +++ b/node_modules/clipboardy/lib/termux.js @@ -0,0 +1,29 @@ +'use strict'; +const execa = require('execa'); + +const handler = err => { + if (err.code === 'ENOENT') { + throw new Error('Couldn\'t find the termux-api scripts. You can install them with: apt install termux-api'); + } + + throw err; +}; + +module.exports = { + copy: opts => execa('termux-clipboard-set', opts).catch(handler), + paste: opts => execa.stdout('termux-clipboard-get', opts).catch(handler), + copySync: opts => { + try { + return execa.sync('termux-clipboard-set', opts); + } catch (err) { + handler(err); + } + }, + pasteSync: opts => { + try { + return execa.sync('termux-clipboard-get', opts); + } catch (err) { + handler(err); + } + } +}; diff --git a/node_modules/clipboardy/lib/windows.js b/node_modules/clipboardy/lib/windows.js new file mode 100644 index 00000000..d8f22941 --- /dev/null +++ b/node_modules/clipboardy/lib/windows.js @@ -0,0 +1,16 @@ +'use strict'; +const path = require('path'); +const execa = require('execa'); +const arch = require('arch'); + +// Binaries from: https://github.com/sindresorhus/win-clipboard +const winBinPath = arch() === 'x64' ? + path.join(__dirname, '../fallbacks/windows/clipboard_x86_64.exe') : + path.join(__dirname, '../fallbacks/windows/clipboard_i686.exe'); + +module.exports = { + copy: opts => execa(winBinPath, ['--copy'], opts), + paste: opts => execa.stdout(winBinPath, ['--paste'], opts), + copySync: opts => execa.sync(winBinPath, ['--copy'], opts), + pasteSync: opts => execa.sync(winBinPath, ['--paste'], opts) +}; diff --git a/node_modules/clipboardy/license b/node_modules/clipboardy/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/clipboardy/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +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. diff --git a/node_modules/clipboardy/package.json b/node_modules/clipboardy/package.json new file mode 100644 index 00000000..29aed0b1 --- /dev/null +++ b/node_modules/clipboardy/package.json @@ -0,0 +1,44 @@ +{ + "name": "clipboardy", + "version": "1.2.3", + "description": "Access the system clipboard (copy/paste)", + "license": "MIT", + "repository": "sindresorhus/clipboardy", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js", + "lib", + "fallbacks" + ], + "keywords": [ + "clipboard", + "copy", + "paste", + "copy-paste", + "pasteboard", + "read", + "write", + "pbcopy", + "clip", + "xclip", + "xsel" + ], + "dependencies": { + "arch": "^2.1.0", + "execa": "^0.8.0" + }, + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/node_modules/clipboardy/readme.md b/node_modules/clipboardy/readme.md new file mode 100644 index 00000000..1c549785 --- /dev/null +++ b/node_modules/clipboardy/readme.md @@ -0,0 +1,64 @@ +# clipboardy [![Build Status: macOS & Linux](https://travis-ci.org/sindresorhus/clipboardy.svg?branch=master)](https://travis-ci.org/sindresorhus/clipboardy) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/gflt3gjn1ia0a3vo/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/clipboardy/branch/master) + +> Access the system clipboard (copy/paste) + +Cross-platform. Supports: macOS, Windows, Linux, OpenBSD, FreeBSD, Android with [Termux](https://termux.com/). + + +## Install + +``` +$ npm install clipboardy +``` + + +## Usage + +```js +const clipboardy = require('clipboardy'); + +clipboardy.writeSync('🦄'); + +clipboardy.readSync(); +//=> '🦄' +``` + + +## API + +### clipboardy + +#### .write(input) + +Write (copy) to the clipboard asynchronously. Returns a `Promise`. + +##### input + +Type: `string` + +#### .read() + +Read (paste) from the clipboard asynchronously. Returns a `Promise`. + +#### .writeSync(input) + +Write (copy) to the clipboard synchronously. + +##### input + +Type: `string` + +#### .readSync() + +Read (paste) from the clipboard synchronously. + + +## Related + +- [clipboard-cli](https://github.com/sindresorhus/clipboard-cli) - CLI for this module +- [copy-text-to-clipboard](https://github.com/sindresorhus/copy-text-to-clipboard) - Copy text to the clipboard in the browser + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) -- cgit v1.2.3