Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Server configurations
const serverConfig = wHandler.getConfig(process.env.PAW_ENV, 'server');
// Web client configurations
const webConfig = wHandler.getConfig(process.env.PAW_ENV, 'web');
const devServerConfig = {
port: pawConfig.port,
host: pawConfig.host,
serverSideRender: pawConfig.serverSideRender,
publicPath: pawConfig.resourcesBaseUrl,
contentBase: path.join(directories.src, 'public'),
};
// Create new logging entity, pawjs
const log = webLog({
name: 'pawjs',
});
const processEnv = process.env;
const isVerbose = processEnv.PAW_VERBOSE === 'true';
const commonOptions = {
stats: {
colors: true,
reasons: isVerbose,
entrypoints: isVerbose,
modules: isVerbose,
moduleTrace: isVerbose,
assets: true,
warnings: isVerbose,
errors: true,
if (!Buffer.isBuffer(content)) {
// TODO need remove in next major release
if (Array.isArray(content)) {
content = content.join('\n');
}
content = Buffer.from(content, 'utf8');
}
mkdirp.sync(path.dirname(targetPath));
try {
fs.writeFileSync(targetPath, content, 'utf-8');
log.debug(
colors.cyan(
`Asset written to disk: ${path.relative(
process.cwd(),
targetPath
)}`
)
);
} catch (e) {
log.error(`Unable to write asset to disk:\n${e}`);
}
}
}
});
}
emit(
compilation: webpack.compilation.Compilation,
callback: (error?: Error) => void
): Promise {
const logger = webpackLog({
name: 'ElasticAPMSourceMapPlugin',
level: this.config.logLevel
});
logger.debug(`starting uploading sourcemaps with configs: ${JSON.stringify(this.config)}.`);
const { chunks = [] } = compilation.getStats().toJson();
return R.compose, Source[], UploadTask[], Promise>(
(promises: Array>) =>
Promise.all(promises)
.then(() => {
logger.debug('finished uploading sourcemaps.');
callback();
})
.catch(err => {
import log from "webpack-log";
const logger = log({ name: "core" });
export type Message = string | string[];
export type Level = "info" | "warn" | "error";
/**
* Logs a message as a specific
* @param message
* @param level
*/
const messenger = (message: Message, level: Level): void => {
if (Array.isArray(message)) {
message.map((item: string) => {
logger[level](item);
});
} else {
logger[level](message);
constructor (options) {
this.options = Object.assign({ logLevel: 'info' }, options || {});
this.options.pruneSource = this.options.pruneSource !== false;
this.urlFilter = this.options.filter;
if (this.urlFilter instanceof RegExp) {
this.urlFilter = this.urlFilter.test.bind(this.urlFilter);
}
this.logger = log({ name: 'Critters', unique: true, level: this.options.logLevel });
}
return fs.writeFile(targetPath, content, (writeFileError) => {
if (writeFileError) {
return callback(writeFileError);
}
log.debug(
colors.cyan(
`Asset written to disk: ${path.relative(
process.cwd(),
targetPath
)}`
)
);
return callback();
});
});