Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(resolve => {
const filename = request.path;
compiler.emit(Compiler.Events.REQUEST_FILE, {
filename,
callback: (result: {
file?: any;
errors: string[];
mimeType: string;
}) => {
resolve(makeResponseFromCompilerResults(h, { filename }, result));
},
});
});
} else {
compiler.on(
Compiler.Events.BUILD_FAILED,
({ platform, message }: { platform: string; message: string }) => {
this.ui.updateCompilationProgress(platform, {
running: false,
value: 0,
});
this.ui.addLogItem(
this.runtime.logger.enhanceWithLevel(Logger.Level.Error, message)
);
}
);
compiler.on(
Compiler.Events.BUILD_FINISHED,
({ platform, errors }: { platform: string; errors: string[] }) => {
this.ui.updateCompilationProgress(platform, {
running: false,
value: 1,
});
errors.forEach(error => {
this.ui.addLogItem(
this.runtime.logger.enhanceWithLevel(Logger.Level.Error, error)
);
});
}
);
return compiler;
}
{
configPath: this.configPath,
configOptions: {
...this.options,
bundleTarget: 'server',
bundleMode:
this.options.bundleNames.length > 1
? 'multi-bundle'
: 'single-bundle',
},
},
this.runtime.logger
);
compiler.on(
Compiler.Events.BUILD_START,
({ platform }: { platform: string }) => {
this.ui.updateCompilationProgress(platform, {
running: true,
value: 0,
});
}
);
compiler.on(
Compiler.Events.BUILD_PROGRESS,
({ progress, platform }: { platform: string; progress: number }) => {
this.ui.updateCompilationProgress(platform, {
running: true,
value: progress,
});
}
createCompiler() {
const compiler = new Compiler(
{
configPath: this.configPath,
configOptions: {
...this.options,
bundleTarget: 'server',
bundleMode:
this.options.bundleNames.length > 1
? 'multi-bundle'
: 'single-bundle',
},
},
this.runtime.logger
);
compiler.on(
Compiler.Events.BUILD_START,