flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

14
BACK_BACK/node_modules/command-exists/.jshintrc generated vendored Executable file
View file

@ -0,0 +1,14 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true,
"boss": true,
"eqnull": true,
"node": true
}

4
BACK_BACK/node_modules/command-exists/.travis.yml generated vendored Executable file
View file

@ -0,0 +1,4 @@
language: node_js
node_js:
- "4"
- "6"

22
BACK_BACK/node_modules/command-exists/LICENSE generated vendored Executable file
View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014 Matthew Conlen
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.

83
BACK_BACK/node_modules/command-exists/README.md generated vendored Executable file
View file

@ -0,0 +1,83 @@
command-exists
==============
node module to check if a command-line command exists
## installation
```bash
npm install command-exists
```
## usage
### async
```js
var commandExists = require('command-exists');
commandExists('ls', function(err, commandExists) {
if(commandExists) {
// proceed confidently knowing this command is available
}
});
```
### promise
```js
var commandExists = require('command-exists');
// invoked without a callback, it returns a promise
commandExists('ls')
.then(function(command){
// proceed
}).catch(function(){
// command doesn't exist
});
```
### sync
```js
var commandExistsSync = require('command-exists').sync;
// returns true/false; doesn't throw
if (commandExistsSync('ls')) {
// proceed
} else {
// ...
}
```
## changelog
### v1.2.7
Removes unnecessary printed output on windows.
### v1.2.6
Small bugfixes.
### v1.2.5
Fix windows bug introduced in 1.2.4.
### v1.2.4
Fix potential security issue.
### v1.2.0
Add support for promises
### v1.1.0
Add synchronous version
### v1.0.2
Support for windows

31
BACK_BACK/node_modules/command-exists/appveyor.yml generated vendored Executable file
View file

@ -0,0 +1,31 @@
init:
# Get the latest stable version of Node.js
- ps: Install-Product node $env:nodejs_version
image:
- Visual Studio 2017
matrix:
fast_finish: true
environment:
matrix:
- nodejs_version: "4"
- nodejs_version: "6"
- nodejs_version: "7"
- nodejs_version: "8"
- nodejs_version: "9"
install:
# install modules
- npm install
# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
- npm run test
# Don't actually build.
build: off

1
BACK_BACK/node_modules/command-exists/index.js generated vendored Executable file
View file

@ -0,0 +1 @@
module.exports = require('./lib/command-exists');

157
BACK_BACK/node_modules/command-exists/lib/command-exists.js generated vendored Executable file
View file

@ -0,0 +1,157 @@
'use strict';
var exec = require('child_process').exec;
var execSync = require('child_process').execSync;
var fs = require('fs');
var path = require('path');
var access = fs.access;
var accessSync = fs.accessSync;
var constants = fs.constants || fs;
var isUsingWindows = process.platform == 'win32'
var fileNotExists = function(commandName, callback){
access(commandName, constants.F_OK,
function(err){
callback(!err);
});
};
var fileNotExistsSync = function(commandName){
try{
accessSync(commandName, constants.F_OK);
return false;
}catch(e){
return true;
}
};
var localExecutable = function(commandName, callback){
access(commandName, constants.F_OK | constants.X_OK,
function(err){
callback(null, !err);
});
};
var localExecutableSync = function(commandName){
try{
accessSync(commandName, constants.F_OK | constants.X_OK);
return true;
}catch(e){
return false;
}
}
var commandExistsUnix = function(commandName, cleanedCommandName, callback) {
fileNotExists(commandName, function(isFile){
if(!isFile){
var child = exec('command -v ' + cleanedCommandName +
' 2>/dev/null' +
' && { echo >&1 ' + cleanedCommandName + '; exit 0; }',
function (error, stdout, stderr) {
callback(null, !!stdout);
});
return;
}
localExecutable(commandName, callback);
});
}
var commandExistsWindows = function(commandName, cleanedCommandName, callback) {
// Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator
if (!(/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName))) {
callback(null, false);
return;
}
var child = exec('where ' + cleanedCommandName,
function (error) {
if (error !== null){
callback(null, false);
} else {
callback(null, true);
}
}
)
}
var commandExistsUnixSync = function(commandName, cleanedCommandName) {
if(fileNotExistsSync(commandName)){
try {
var stdout = execSync('command -v ' + cleanedCommandName +
' 2>/dev/null' +
' && { echo >&1 ' + cleanedCommandName + '; exit 0; }'
);
return !!stdout;
} catch (error) {
return false;
}
}
return localExecutableSync(commandName);
}
var commandExistsWindowsSync = function(commandName, cleanedCommandName, callback) {
// Regex from Julio from: https://stackoverflow.com/questions/51494579/regex-windows-path-validator
if (!(/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(commandName))) {
return false;
}
try {
var stdout = execSync('where ' + cleanedCommandName, {stdio: []});
return !!stdout;
} catch (error) {
return false;
}
}
var cleanInput = function(s) {
if (/[^A-Za-z0-9_\/:=-]/.test(s)) {
s = "'"+s.replace(/'/g,"'\\''")+"'";
s = s.replace(/^(?:'')+/g, '') // unduplicate single-quote at the beginning
.replace(/\\'''/g, "\\'" ); // remove non-escaped single-quote if there are enclosed between 2 escaped
}
return s;
}
if (isUsingWindows) {
cleanInput = function(s) {
var isPathName = /[\\]/.test(s);
if (isPathName) {
var dirname = '"' + path.dirname(s) + '"';
var basename = '"' + path.basename(s) + '"';
return dirname + ':' + basename;
}
return '"' + s + '"';
}
}
module.exports = function commandExists(commandName, callback) {
var cleanedCommandName = cleanInput(commandName);
if (!callback && typeof Promise !== 'undefined') {
return new Promise(function(resolve, reject){
commandExists(commandName, function(error, output) {
if (output) {
resolve(commandName);
} else {
reject(error);
}
});
});
}
if (isUsingWindows) {
commandExistsWindows(commandName, cleanedCommandName, callback);
} else {
commandExistsUnix(commandName, cleanedCommandName, callback);
}
};
module.exports.sync = function(commandName) {
var cleanedCommandName = cleanInput(commandName);
if (isUsingWindows) {
return commandExistsWindowsSync(commandName, cleanedCommandName);
} else {
return commandExistsUnixSync(commandName, cleanedCommandName);
}
};

32
BACK_BACK/node_modules/command-exists/package.json generated vendored Executable file
View file

@ -0,0 +1,32 @@
{
"name": "command-exists",
"version": "1.2.9",
"description": "check whether a command line command exists in the current environment",
"main": "index.js",
"scripts": {
"test": "mocha test/test.js"
},
"repository": {
"type": "git",
"url": "http://github.com/mathisonian/command-exists"
},
"keywords": [
"cli",
"command",
"exists"
],
"author": "Matthew Conlen",
"contributors": [
"Arthur Silber <arthur@arthursilber.de> (https://arthursilber.de)"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/mathisonian/command-exists/issues"
},
"homepage": "https://github.com/mathisonian/command-exists",
"devDependencies": {
"expect.js": "^0.3.1",
"jshint": "^2.9.1",
"mocha": "^2.5.3"
}
}

View file

View file

View file

147
BACK_BACK/node_modules/command-exists/test/test.js generated vendored Executable file
View file

@ -0,0 +1,147 @@
'use strict';
var expect = require('expect.js');
var commandExists = require('..');
var commandExistsSync = commandExists.sync;
var resolve = require('path').resolve;
var isUsingWindows = process.platform == 'win32'
describe('commandExists', function(){
describe('async - callback', function() {
it('it should find a command named ls or xcopy', function(done){
var commandToUse = 'ls'
if (isUsingWindows) {
commandToUse = 'xcopy'
}
commandExists(commandToUse, function(err, exists) {
expect(err).to.be(null);
expect(exists).to.be(true);
done();
});
});
it('it should not find a command named fdsafdsafdsafdsafdsa', function(done){
commandExists('fdsafdsafdsafdsafdsa', function(err, exists) {
expect(err).to.be(null);
expect(exists).to.be(false);
done();
});
});
});
describe('async - promise', function() {
it('it should find a command named ls or xcopy', function(done){
var commandToUse = 'ls'
if (isUsingWindows) {
commandToUse = 'xcopy'
}
commandExists(commandToUse)
.then(function(command) {
expect(command).to.be(commandToUse);
done();
});
});
it('it should not find a command named fdsafdsafdsafdsafdsa', function(done){
commandExists('fdsafdsafdsafdsafdsa')
.then(function() {
// We should not execute this line.
expect(true).to.be(false);
})
.catch(function() {
done();
});
});
});
describe('sync', function() {
it('it should find a command named ls or xcopy', function(){
var commandToUse = 'ls'
if (isUsingWindows) {
commandToUse = 'xcopy'
}
expect(commandExistsSync(commandToUse)).to.be(true);
});
it('it should not find a command named fdsafdsafdsafdsafdsa', function(){
expect(commandExistsSync('fdsafdsafdsafdsafdsa')).to.be(false);
});
it('it should not find a command named ls or xcopy prefixed with some nonsense', function(){
var commandToUse = 'fdsafdsa ls'
if (isUsingWindows) {
commandToUse = 'fdsafdsaf xcopy'
}
expect(commandExistsSync(commandToUse)).to.be(false);
});
it('it should not execute some nefarious code', function(){
expect(commandExistsSync('ls; touch /tmp/foo0')).to.be(false);
});
it('it should not execute some nefarious code', function(){
expect(commandExistsSync('ls touch /tmp/foo0')).to.be(false);
});
});
describe('local file', function() {
it('it should report false if there is a non-executable file with that name', function(done) {
var commandToUse = 'test/non-executable-script.js'
commandExists(commandToUse)
.then(function(command){
// We should not execute this line.
expect(true).to.be(false);
}).catch(function(err){
expect(err).to.be(null);
done();
});
});
if (!isUsingWindows) {
it('it should report true if there is an executable file with that name', function(done) {
var commandToUse = 'test/executable-script.js'
commandExists(commandToUse)
.then(function(command){
// We should not execute this line.
expect(command).to.be(commandToUse);
done();
});
});
}
if (isUsingWindows) {
it('it should report true if there is an executable file with that name', function(done) {
var commandToUse = 'test\\executable-script.cmd'
commandExists(commandToUse)
.then(function(command){
expect(command).to.be(commandToUse);
done();
});
});
it('it should report false if there is a double quotation mark in the file path', function() {
var commandToUse = 'test\\"executable-script.cmd'
expect(commandExists.sync(commandToUse)).to.be(false);
});
}
});
describe('absolute path', function() {
it('it should report true if there is a command with that name in absolute path', function(done) {
var commandToUse = resolve('test/executable-script.js');
commandExists(commandToUse)
.then(function(command){
expect(command).to.be(commandToUse);
done();
});
});
it('it should report false if there is not a command with that name in absolute path', function() {
var commandToUse = resolve('executable-script.js');
expect(commandExists.sync(commandToUse)).to.be(false);
});
});
});