Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static _processDependencies(jsonObject,path,options,modelFiles,modelFileNames){
const method='_processDependencies';
LOG.debug(method, 'All dependencies', Object.keys(jsonObject.dependencies).toString());
const dependencies = Object.keys(jsonObject.dependencies).filter(minimatch.filter(options.dependencyGlob, { dot: true }));
LOG.debug(method, 'Matched dependencies', dependencies);
for( let dep of dependencies) {
// find all the *.cto files under the npm install dependency path
let dependencyPath = fsPath.resolve(path, 'node_modules', dep);
LOG.debug(method, 'Checking dependency path', dependencyPath);
if (!fs.existsSync(dependencyPath)) {
// need to check to see if this is in a peer directory as well
//
LOG.debug(method,'trying different path '+path.replace(jsonObject.name,''));
dependencyPath = fsPath.resolve(path.replace(jsonObject.name,''),dep);
if(!fs.existsSync(dependencyPath)){
throw new Error('npm dependency path ' + dependencyPath + ' does not exist. Did you run npm install?');
}
}
var globFilter = function() { return true; };
var options = false;
if (param2 && typeof param2 === "object") {
// when used in the following manner module(some transform function or transform script filename, some cheerio options)
options = param2
}
if (param3 && typeof param3 === "object") {
// when used in the following manner module('filter',some transform function or transform script filename, some cheerio options)
options = param3
}
if (param2 && typeof param2 !== "object") {
// when used in the following manner module('filter',some transform function or transform script filename)
globFilter = minimatch.filter(param1);
// shift parameters
param1 = param2;
}
if (typeof param1 === "string") {
var filename = path.resolve(process.cwd(), param1);
debug("Loading file: " + filename);
transform = require(filename);
} else if (typeof param1 !== "function") {
debug("No transform function found");
} else {
transform = param1;
}
import OptimizeCssAssetsPlugin from 'optimize-css-assets-webpack-plugin';
import CrittersPlugin from 'critters-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin';
import CleanPlugin from 'clean-webpack-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import autoprefixer from 'autoprefixer';
import rreaddir from 'recursive-readdir-sync';
import minimatch from 'minimatch';
// import ssr from './src/ssr';
import config from './src/config.json';
// global.fetch = require('isomorphic-fetch');
// import 'isomorphic-fetch';
// import './src/lib/polyfills';
const CONTENT = rreaddir('content').filter(minimatch.filter('**/*.md')).filter(minimatch.filter('!content/lang/**')).map( s => '/'+s );
const ENV = process.env.NODE_ENV || 'development';
const CSS_MAPS = ENV!=='production';
const VENDORS = /\bbabel\-standalone\b/;
const babelConfig = JSON.parse(fs.readFileSync('./.babelrc', 'utf-8'));
babelConfig.presets[0][1].modules = false;
module.exports = {
context: path.resolve(__dirname, 'src'),
// entry: {
// polyfills: path.resolve(__dirname, 'src/lib/polyfills.js'),
// main: path.resolve(__dirname, 'src/index.js')
// },
return tasks.filter(copy => {
let copySrc = copy.src;
if (isGlob(copySrc)) {
// test the glob
copySrc = config.sys.path.join(config.srcDir, copySrc);
if (changedFiles.some(minimatch.filter(copySrc))) {
return true;
}
} else {
copySrc = normalizePath(getSrcAbsPath(config, copySrc + '/'));
if (changedFiles.some(f => f.startsWith(copySrc))) {
return true;
}
}
return false;
});
}
const matchesFilter = (asset, pattern) => {
const relativeToRoot = path.relative(process.cwd(), asset.absolutePath);
if (typeof pattern === 'string') {
pattern = minimatch.filter(pattern);
return pattern(relativeToRoot);
}
if (pattern instanceof RegExp) {
return pattern.test(relativeToRoot);
}
if (pattern instanceof Function) {
return pattern(asset);
}
return true;
};
function createMatcher(pattern) {
if (!pattern) return function matchAll() { return true; };
return minimatch.filter(pattern, {
nobrace: true,
noglobstar: true,
dot: true,
noext: true,
nocomment: true,
});
}
function filter(pattern, options) {
return minimatch.filter(pattern, options);
}
exports.filter = filter;
const fns = globs.map(glob => minimatch.filter(glob, { matchBase: true }));