Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const fs = require('fs');
const path = require('path');
const rimraf = require('mz-modules/rimraf');
const eggPath = path.join(__dirname, 'node_modules/egg-core');
rimraf.sync(eggPath);
fs.symlinkSync(
path.join(__dirname, '../../..'),
eggPath,
'dir'
);
const EggCore = require('egg-core').EggCore;
const EggLoader = require('egg-core').EggLoader;
class AppLoader extends EggLoader {
loadAll() {
this.loadPlugin();
this.loadConfig();
this.loadApplicationExtend();
this.loadContextExtend();
this.loadRequestExtend();
this.loadResponseExtend();
this.loadBootHook();
this.loadCustomApp();
this.loadMiddleware();
this.loadService();
this.loadController();
this.loadRouter();
}
'use strict';
const fs = require('fs');
const path = require('path');
const rimraf = require('mz-modules/rimraf');
const eggPath = path.join(__dirname, 'node_modules/egg-core');
rimraf.sync(eggPath);
fs.symlinkSync(
path.join(__dirname, '../../..'),
eggPath,
'dir'
);
const EggCore = require('egg-core').EggCore;
const EggLoader = require('egg-core').EggLoader;
class AppLoader extends EggLoader {
loadAll() {
this.loadPlugin();
this.loadConfig();
this.loadApplicationExtend();
this.loadContextExtend();
this.loadRequestExtend();
this.loadResponseExtend();
this.loadCustomApp();
this.loadMiddleware();
this.loadService();
this.loadController();
this.loadRouter();
}
}
'use strict';
const EggLoader = require('egg-core').EggLoader;
/**
* Agent worker process loader
* @see https://github.com/eggjs/egg-loader
*/
class AgentWorkerLoader extends EggLoader {
/**
* loadPlugin first, then loadConfig
*/
loadConfig() {
this.loadPlugin();
super.loadConfig();
}
load() {
'use strict';
const EggLoader = require('egg-core').EggLoader;
/**
* App worker process Loader, will load plugins
* @see https://github.com/eggjs/egg-loader
*/
class AppWorkerLoader extends EggLoader {
/**
* loadPlugin first, then loadConfig
* @since 1.0.0
*/
loadConfig() {
this.loadPlugin();
super.loadConfig();
}
'use strict';
const EggLoader = require('egg-core').EggLoader;
/**
* Agent worker process loader
* @see https://github.com/eggjs/egg-loader
*/
class AgentWorkerLoader extends EggLoader {
/**
* loadPlugin first, then loadConfig
*/
loadConfig() {
this.loadPlugin();
super.loadConfig();
}
load() {
RouterOption,
WEB_ROUTER_KEY,
WEB_ROUTER_PARAM_KEY,
RouterParamValue,
} from '@midwayjs/decorator';
import * as extend from 'extend2';
import * as fs from 'fs';
import { getClassMetadata, getPropertyDataFromClass, getProviderId, listModule } from 'injection';
import { ContainerLoader, MidwayHandlerKey, MidwayContainer } from 'midway-core';
import * as path from 'path';
import { Middleware, MiddlewareParamArray, MidwayLoaderOptions, WebMiddleware } from '../interface';
import { isTypeScriptEnvironment, safelyGet } from '../utils';
import { EggAppInfo } from 'egg';
const debug = require('debug')(`midway:loader:${process.pid}`);
const EggLoader = require('egg-core').EggLoader;
const TS_SRC_DIR = 'src';
const TS_TARGET_DIR = 'dist';
export class MidwayWebLoader extends EggLoader {
public baseDir: string;
public appDir: string;
public appInfo: EggAppInfo;
private controllerIds: string[] = [];
private prioritySortRouters: Array<{
priority: number,
router: Router,
}> = [];
private containerLoader: ContainerLoader;
constructor(options: MidwayLoaderOptions) {
'use strict';
const EggLoader = require('egg-core').EggLoader;
/**
* App worker process Loader, will load plugins
* @see https://github.com/eggjs/egg-loader
*/
class AppWorkerLoader extends EggLoader {
/**
* loadPlugin first, then loadConfig
* @since 1.0.0
*/
loadConfig() {
this.loadPlugin();
super.loadConfig();
}
'use strict';
exports.EggLoader = require('egg-core').EggLoader;
exports.AppWorkerLoader = require('./app_worker_loader');
exports.AgentWorkerLoader = require('./agent_worker_loader');