mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-03 21:40:53 +00:00
nhj
more
This commit is contained in:
1
unified-ai-platform/node_modules/require-directory/.npmignore
generated
vendored
Normal file
1
unified-ai-platform/node_modules/require-directory/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
test/**
|
||||
22
unified-ai-platform/node_modules/require-directory/LICENSE
generated
vendored
Normal file
22
unified-ai-platform/node_modules/require-directory/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2011 Troy Goode <troygoode@gmail.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.
|
||||
86
unified-ai-platform/node_modules/require-directory/index.js
generated
vendored
Normal file
86
unified-ai-platform/node_modules/require-directory/index.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs'),
|
||||
join = require('path').join,
|
||||
resolve = require('path').resolve,
|
||||
dirname = require('path').dirname,
|
||||
defaultOptions = {
|
||||
extensions: ['js', 'json', 'coffee'],
|
||||
recurse: true,
|
||||
rename: function (name) {
|
||||
return name;
|
||||
},
|
||||
visit: function (obj) {
|
||||
return obj;
|
||||
}
|
||||
};
|
||||
|
||||
function checkFileInclusion(path, filename, options) {
|
||||
return (
|
||||
// verify file has valid extension
|
||||
(new RegExp('\\.(' + options.extensions.join('|') + ')$', 'i').test(filename)) &&
|
||||
|
||||
// if options.include is a RegExp, evaluate it and make sure the path passes
|
||||
!(options.include && options.include instanceof RegExp && !options.include.test(path)) &&
|
||||
|
||||
// if options.include is a function, evaluate it and make sure the path passes
|
||||
!(options.include && typeof options.include === 'function' && !options.include(path, filename)) &&
|
||||
|
||||
// if options.exclude is a RegExp, evaluate it and make sure the path doesn't pass
|
||||
!(options.exclude && options.exclude instanceof RegExp && options.exclude.test(path)) &&
|
||||
|
||||
// if options.exclude is a function, evaluate it and make sure the path doesn't pass
|
||||
!(options.exclude && typeof options.exclude === 'function' && options.exclude(path, filename))
|
||||
);
|
||||
}
|
||||
|
||||
function requireDirectory(m, path, options) {
|
||||
var retval = {};
|
||||
|
||||
// path is optional
|
||||
if (path && !options && typeof path !== 'string') {
|
||||
options = path;
|
||||
path = null;
|
||||
}
|
||||
|
||||
// default options
|
||||
options = options || {};
|
||||
for (var prop in defaultOptions) {
|
||||
if (typeof options[prop] === 'undefined') {
|
||||
options[prop] = defaultOptions[prop];
|
||||
}
|
||||
}
|
||||
|
||||
// if no path was passed in, assume the equivelant of __dirname from caller
|
||||
// otherwise, resolve path relative to the equivalent of __dirname
|
||||
path = !path ? dirname(m.filename) : resolve(dirname(m.filename), path);
|
||||
|
||||
// get the path of each file in specified directory, append to current tree node, recurse
|
||||
fs.readdirSync(path).forEach(function (filename) {
|
||||
var joined = join(path, filename),
|
||||
files,
|
||||
key,
|
||||
obj;
|
||||
|
||||
if (fs.statSync(joined).isDirectory() && options.recurse) {
|
||||
// this node is a directory; recurse
|
||||
files = requireDirectory(m, joined, options);
|
||||
// exclude empty directories
|
||||
if (Object.keys(files).length) {
|
||||
retval[options.rename(filename, joined, filename)] = files;
|
||||
}
|
||||
} else {
|
||||
if (joined !== m.filename && checkFileInclusion(joined, filename, options)) {
|
||||
// hash node key shouldn't include file extension
|
||||
key = filename.substring(0, filename.lastIndexOf('.'));
|
||||
obj = m.require(joined);
|
||||
retval[options.rename(key, joined, filename)] = options.visit(obj, joined, filename) || obj;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
module.exports = requireDirectory;
|
||||
module.exports.defaults = defaultOptions;
|
||||
40
unified-ai-platform/node_modules/require-directory/package.json
generated
vendored
Normal file
40
unified-ai-platform/node_modules/require-directory/package.json
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"author": "Troy Goode <troygoode@gmail.com> (http://github.com/troygoode/)",
|
||||
"name": "require-directory",
|
||||
"version": "2.1.1",
|
||||
"description": "Recursively iterates over specified directory, require()'ing each file, and returning a nested hash structure containing those modules.",
|
||||
"keywords": [
|
||||
"require",
|
||||
"directory",
|
||||
"library",
|
||||
"recursive"
|
||||
],
|
||||
"homepage": "https://github.com/troygoode/node-require-directory/",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/troygoode/node-require-directory.git"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Troy Goode",
|
||||
"email": "troygoode@gmail.com",
|
||||
"web": "http://github.com/troygoode/"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "http://github.com/troygoode/node-require-directory/issues/"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jshint": "^2.6.0",
|
||||
"mocha": "^2.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"lint": "jshint index.js test/test.js"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user