Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
get maxParallelFiles(): number {
const {npmbundlerrc} = this._project;
// Default values for "ulimit -n" vary across different OSes. Some
//
// values I have found are:
// - Apparently Mac OS X limit is 256 but usually people increase it
// - Fedora: 1024
// - Windows: there's no ulimit, but MSVCRT.DLL has a 2048 limit
//
// Given this mess and the impossibility of retrieving the limit from
// Node, I'm giving this a default value of 128 because it looks like it
// doesn't impact performance and should be low enough to make it work
// in all OSes.
return prop.get(npmbundlerrc, 'max-parallel-files', 128);
}
// or, if ref path is like: #/components/schemas/A/properties/a
type = refPath[refPath.length - 4];
}
if (['schemas', 'parameters', 'responses'].includes(refPath[refPath.length - 2])) {
// in case of a ref like #/components/schemas/A or #/components/parameters/A or #/components/responses/A
// schema name is the last element of the path
schemaName = refPath[refPath.length - 1];
} else if (refPath[refPath.length - 2] === 'properties') {
// in case of a ref like #/components/schemas/A/properties/B
// schema name is A, then:
schemaName = refPath[refPath.length - 3];
}
if (['schemas', 'parameters', 'responses'].includes(type)) {
// check if the reference points to an existing path in spec
if (!dot.get(spec as any, refPath.slice(1).join('.'))) {
throw new Error(`Referenced path "${obj[key]}" doesn't exist in spec.`);
} else {
occurrences[type][schemaName]['count'] += 1;
occurrences[type][schemaName]['referencedBy'].push(currentPath.slice(0, 3).join('.'));
}
}
}
const prop = obj[key];
// recursively find and count...
if (prop && typeof prop === 'object') {
if (!Array.isArray(prop)) {
if (!parsedProps.find(p => p === prop)) {
parsedProps.push(prop);
findAndCount(prop, currentPath);
}
} else {
function rebaseOASDefinition(fullSpec: any, schemaKey: string, schema: any, path: string, definitionsPath: string[]): any {
if (schema.definitions) {
for (const defKey in schema.definitions) {
// current recursive definition path chain
const chain = [...definitionsPath, defKey];
const newPath = `${path}.definitions.${defKey}`;
const definition = dot.get(fullSpec, newPath);
fullSpec = rebaseOASDefinition(fullSpec, defKey, definition, newPath, chain);
const newSchemaName = `${chain.join('_')}`;
// move to components/schemas and get a new ref related to the new path
fullSpec = moveDefinition(fullSpec, newSchemaName, newPath);
}
dot.delete(fullSpec, `${path}.definitions`);
}
return fullSpec;
}
module.exports = function retrieveFromPath (item, path) {
return dotProp.get(item, (path === '') ? null : path)
}
export default (str: string) => {
return dotProp.get(obj, str)
}
export function getConfigurationFile() {
const jarConfig = getNormalizedJarConfig();
let defaultValue = undefined;
if (fs.existsSync('./features/configuration.json')) {
defaultValue = 'features/configuration.json';
}
return prop.get(jarConfig, 'features.configuration', defaultValue);
}
this.$getSource = function (propertyPath) {
if (propertyPath) {
return dotProp.get(_source, propertyPath);
} else {
return _source;
}
};
/**
module.exports = function subpathExternals(pkg, output) {
const external = dotProp.get(pkg, 'rollup.external');
const bundled = dotProp.get(pkg, 'rollup.bundle');
const { format } = output || {};
const { dependencies = {}, peerDependencies = {} } = pkg;
let pkgDeps;
if (external) {
pkgDeps = external;
} else if (format === 'umd') {
pkgDeps = Object.keys(peerDependencies);
} else {
pkgDeps = Object.keys(dependencies).concat(Object.keys(peerDependencies));
}
if (bundled) {
const inlined = new Set(bundled);
this.modifyJson(json => {
let test = regex.toString();
test = test.substring(1, test.length - 1);
const currentRules = prop.get(json, 'webpack.rules', []);
currentRules.push({
test,
use: loader,
});
prop.set(json, 'webpack.rules', currentRules);
});
}
export function getTags(submission: Submission, website: string): string[] {
let tags: string[] = dotProp.get(submission.formData, 'defaults.tags.tags', []);
const customTags: TagData = dotProp.get(submission.formData, `${website}.tags`, { extend: true }) || { extend: true };
if (customTags.extend) {
tags = [...tags, ...(customTags.tags || [])];
} else {
tags = (customTags.tags || []);
}
return tags;
}