mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-04 14:00:49 +00:00
nhj
more
This commit is contained in:
21
unified-ai-platform/node_modules/rechoir/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/rechoir/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2019, 2021 Tyler Kellen <tyler@sleekcode.net>, Blaine Bublitz <blaine.bublitz@gmail.com>, and Eric Schoffstall <yo@contra.io>
|
||||
|
||||
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.
|
||||
69
unified-ai-platform/node_modules/rechoir/index.js
generated
vendored
Normal file
69
unified-ai-platform/node_modules/rechoir/index.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
var path = require('path');
|
||||
|
||||
var extension = require('./lib/extension');
|
||||
var normalize = require('./lib/normalize');
|
||||
var register = require('./lib/register');
|
||||
|
||||
exports.prepare = function (extensions, filepath, cwd, nothrow) {
|
||||
var config, usedExtension, err, option, attempt, error;
|
||||
var attempts = [];
|
||||
var onlyErrors = true;
|
||||
var exts = extension(filepath);
|
||||
|
||||
if (exts) {
|
||||
exts.some(function (ext) {
|
||||
usedExtension = ext;
|
||||
config = normalize(extensions[ext]);
|
||||
return !!config;
|
||||
});
|
||||
}
|
||||
|
||||
if (Object.keys(require.extensions).indexOf(usedExtension) !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!config) {
|
||||
if (nothrow) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error('No module loader found for "' + usedExtension + '".');
|
||||
}
|
||||
|
||||
if (!cwd) {
|
||||
cwd = path.dirname(path.resolve(filepath));
|
||||
}
|
||||
if (!Array.isArray(config)) {
|
||||
config = [config];
|
||||
}
|
||||
|
||||
for (var i in config) {
|
||||
option = config[i];
|
||||
attempt = register(cwd, option.module, option.register);
|
||||
error = attempt instanceof Error ? attempt : null;
|
||||
if (error) {
|
||||
attempt = null;
|
||||
}
|
||||
attempts.push({
|
||||
moduleName: option.module,
|
||||
module: attempt,
|
||||
error: error,
|
||||
});
|
||||
if (!error) {
|
||||
onlyErrors = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (onlyErrors) {
|
||||
err = new Error(
|
||||
'Unable to use specified module loaders for "' + usedExtension + '".'
|
||||
);
|
||||
err.failures = attempts;
|
||||
if (nothrow) {
|
||||
return err;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
return attempts;
|
||||
};
|
||||
44
unified-ai-platform/node_modules/rechoir/lib/extension.js
generated
vendored
Normal file
44
unified-ai-platform/node_modules/rechoir/lib/extension.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
|
||||
function getLongExtension(basename) {
|
||||
if (basename[basename.length - 1] === '.') {
|
||||
return null;
|
||||
}
|
||||
|
||||
var startIndex = basename[0] === '.' ? 1 : 0;
|
||||
|
||||
var dotIndex = basename.indexOf('.', startIndex);
|
||||
if (dotIndex <= startIndex) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return basename.slice(dotIndex);
|
||||
}
|
||||
|
||||
function getPossibleExtensions(longExtension) {
|
||||
var arr = [longExtension];
|
||||
var len = longExtension.length;
|
||||
var startIndex = 1;
|
||||
|
||||
while (startIndex < len) {
|
||||
var dotIndex = longExtension.indexOf('.', startIndex);
|
||||
if (dotIndex < 0) {
|
||||
break;
|
||||
}
|
||||
arr.push(longExtension.slice(dotIndex));
|
||||
startIndex = dotIndex + 1;
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
module.exports = function (input) {
|
||||
var basename = path.basename(input);
|
||||
var longExtension = getLongExtension(basename);
|
||||
if (!longExtension) {
|
||||
return;
|
||||
}
|
||||
return getPossibleExtensions(longExtension);
|
||||
};
|
||||
0
unified-ai-platform/node_modules/rechoir/lib/normalize.js
generated
vendored
Normal file
0
unified-ai-platform/node_modules/rechoir/lib/normalize.js
generated
vendored
Normal file
Reference in New Issue
Block a user