This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

69
node_modules/fbjs-scripts/node/check-dev-engines.js generated vendored Normal file
View File

@ -0,0 +1,69 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*eslint-disable max-len*/
'use strict';
var fs = require('fs');
var assert = require('assert');
var exec = require('child_process').exec;
var semver = require('semver');
var f = require('util').format;
// Make sure we have a package.json to parse. Take it as the first argument
// (actually the 3rd for argv).
assert(
process.argv.length >= 3,
'Expected to receive a package.json file argument to parse'
);
var packageFilePath = process.argv[2];
var packageData;
try {
var packageFile = fs.readFileSync(packageFilePath, {encoding: 'utf-8'});
packageData = JSON.parse(packageFile);
} catch (e) {
assert(
false,
f('Expected to be able to parse %s as JSON but we got this error instead: %s', packageFilePath, e)
);
}
var devEngines = packageData.devEngines;
if (devEngines.node !== undefined) {
// First check that devEngines are valid semver
assert(
semver.validRange(devEngines.node),
f('devEngines.node (%s) is not a valid semver range', devEngines.node)
);
// Then actually check that our version satisfies
var nodeVersion = process.versions.node;
assert(
semver.satisfies(nodeVersion, devEngines.node),
f('Current node version is not supported for development, expected "%s" to satisfy "%s".', nodeVersion, devEngines.node)
);
}
if (devEngines.npm !== undefined) {
// First check that devEngines are valid semver
assert(
semver.validRange(devEngines.npm),
f('devEngines.npm (%s) is not a valid semver range', devEngines.npm)
);
// Then actually check that our version satisfies
exec('npm --version', function(err, stdout, stderr) {
assert(err === null, f('Failed to get npm version... %s'), stderr);
var npmVersion = stdout.trim();
assert(
semver.satisfies(npmVersion, devEngines.npm),
f('Current npm version is not supported for development, expected "%s" to satisfy "%s".', npmVersion, devEngines.npm)
);
});
}

47
node_modules/fbjs-scripts/node/check-lib-requires.js generated vendored Normal file
View File

@ -0,0 +1,47 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const EXTRACT_MODULE_NAME_REGEX = /'\.\/(.+)'/;
let didError = false;
// Make sure we have a lib to read files from. Take it as the first argument.
assert(
process.argv.length >= 3,
'Expected to receive an argument to a lib directory'
);
const pathToLib = path.resolve(process.cwd(), process.argv[2]);
fs.readdir(pathToLib, (err, files) => {
files = files.filter((filename) => path.parse(filename).ext === '.js');
files.forEach((filename) => {
const requirePath = path.join(pathToLib, filename);
const moduleName = path.parse(filename).name;
try {
require(requirePath);
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
const missingModule = e.toString().match(EXTRACT_MODULE_NAME_REGEX)[1];
console.error(moduleName, 'is missing a dependency:', missingModule);
} else {
console.error('UNKNOWN ERROR', e);
}
didError = true;
}
});
process.exit(didError ? 1 : 0);
});