first commit
This commit is contained in:
57
app_vue/node_modules/clipboardy/lib/linux.js
generated
vendored
Normal file
57
app_vue/node_modules/clipboardy/lib/linux.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const execa = require('execa');
|
||||
|
||||
const xsel = 'xsel';
|
||||
const xselFallback = path.join(__dirname, '../fallbacks/linux/xsel');
|
||||
|
||||
const copyArguments = ['--clipboard', '--input'];
|
||||
const pasteArguments = ['--clipboard', '--output'];
|
||||
|
||||
const makeError = (xselError, fallbackError) => {
|
||||
let error;
|
||||
if (xselError.code === 'ENOENT') {
|
||||
error = new Error('Couldn\'t find the `xsel` binary and fallback didn\'t work. On Debian/Ubuntu you can install xsel with: sudo apt install xsel');
|
||||
} else {
|
||||
error = new Error('Both xsel and fallback failed');
|
||||
error.xselError = xselError;
|
||||
}
|
||||
|
||||
error.fallbackError = fallbackError;
|
||||
return error;
|
||||
};
|
||||
|
||||
const xselWithFallback = async (argumentList, options) => {
|
||||
try {
|
||||
return await execa.stdout(xsel, argumentList, options);
|
||||
} catch (xselError) {
|
||||
try {
|
||||
return await execa.stdout(xselFallback, argumentList, options);
|
||||
} catch (fallbackError) {
|
||||
throw makeError(xselError, fallbackError);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const xselWithFallbackSync = (argumentList, options) => {
|
||||
try {
|
||||
return execa.sync(xsel, argumentList, options);
|
||||
} catch (xselError) {
|
||||
try {
|
||||
return execa.sync(xselFallback, argumentList, options);
|
||||
} catch (fallbackError) {
|
||||
throw makeError(xselError, fallbackError);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
copy: async options => {
|
||||
await xselWithFallback(copyArguments, options);
|
||||
},
|
||||
copySync: options => {
|
||||
xselWithFallbackSync(copyArguments, options);
|
||||
},
|
||||
paste: options => xselWithFallback(pasteArguments, options),
|
||||
pasteSync: options => xselWithFallbackSync(pasteArguments, options)
|
||||
};
|
14
app_vue/node_modules/clipboardy/lib/macos.js
generated
vendored
Normal file
14
app_vue/node_modules/clipboardy/lib/macos.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
const execa = require('execa');
|
||||
|
||||
const env = {
|
||||
...process.env,
|
||||
LC_CTYPE: 'UTF-8'
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
copy: async options => execa('pbcopy', {...options, env}),
|
||||
paste: async options => execa.stdout('pbpaste', {...options, env}),
|
||||
copySync: options => execa.sync('pbcopy', {...options, env}),
|
||||
pasteSync: options => execa.sync('pbpaste', {...options, env})
|
||||
};
|
41
app_vue/node_modules/clipboardy/lib/termux.js
generated
vendored
Normal file
41
app_vue/node_modules/clipboardy/lib/termux.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
const execa = require('execa');
|
||||
|
||||
const handler = error => {
|
||||
if (error.code === 'ENOENT') {
|
||||
throw new Error('Couldn\'t find the termux-api scripts. You can install them with: apt install termux-api');
|
||||
}
|
||||
|
||||
throw error;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
copy: async options => {
|
||||
try {
|
||||
await execa('termux-clipboard-set', options);
|
||||
} catch (error) {
|
||||
handler(error);
|
||||
}
|
||||
},
|
||||
paste: async options => {
|
||||
try {
|
||||
return await execa.stdout('termux-clipboard-get', options);
|
||||
} catch (error) {
|
||||
handler(error);
|
||||
}
|
||||
},
|
||||
copySync: options => {
|
||||
try {
|
||||
execa.sync('termux-clipboard-set', options);
|
||||
} catch (error) {
|
||||
handler(error);
|
||||
}
|
||||
},
|
||||
pasteSync: options => {
|
||||
try {
|
||||
return execa.sync('termux-clipboard-get', options);
|
||||
} catch (error) {
|
||||
handler(error);
|
||||
}
|
||||
}
|
||||
};
|
16
app_vue/node_modules/clipboardy/lib/windows.js
generated
vendored
Normal file
16
app_vue/node_modules/clipboardy/lib/windows.js
generated
vendored
Normal file
@ -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 windowBinaryPath = arch() === 'x64' ?
|
||||
path.join(__dirname, '../fallbacks/windows/clipboard_x86_64.exe') :
|
||||
path.join(__dirname, '../fallbacks/windows/clipboard_i686.exe');
|
||||
|
||||
module.exports = {
|
||||
copy: async options => execa(windowBinaryPath, ['--copy'], options),
|
||||
paste: async options => execa.stdout(windowBinaryPath, ['--paste'], options),
|
||||
copySync: options => execa.sync(windowBinaryPath, ['--copy'], options),
|
||||
pasteSync: options => execa.sync(windowBinaryPath, ['--paste'], options)
|
||||
};
|
Reference in New Issue
Block a user