MCPcopy Index your code
hub / github.com/callstack/haul / createCompiler

Method createCompiler

packages/haul-core/src/server/Server.ts:52–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50 }
51
52 createCompiler() {
53 const compiler = new Compiler(
54 {
55 configPath: this.configPath,
56 configOptions: {
57 ...this.options,
58 bundleTarget: 'server',
59 bundleMode:
60 this.options.bundleNames.length > 1
61 ? 'multi-bundle'
62 : 'single-bundle',
63 },
64 },
65 this.runtime.logger
66 );
67
68 compiler.on(
69 Compiler.Events.BUILD_START,
70 ({ platform }: { platform: string }) => {
71 this.ui.updateCompilationProgress(platform, {
72 running: true,
73 value: 0,
74 });
75 }
76 );
77
78 compiler.on(
79 Compiler.Events.BUILD_PROGRESS,
80 ({ progress, platform }: { platform: string; progress: number }) => {
81 this.ui.updateCompilationProgress(platform, {
82 running: true,
83 value: progress,
84 });
85 }
86 );
87
88 compiler.on(
89 Compiler.Events.BUILD_FAILED,
90 ({ platform, message }: { platform: string; message: string }) => {
91 this.ui.updateCompilationProgress(platform, {
92 running: false,
93 value: 0,
94 });
95 this.ui.addLogItem(
96 this.runtime.logger.enhanceWithLevel(Logger.Level.Error, message)
97 );
98 }
99 );
100
101 compiler.on(
102 Compiler.Events.BUILD_FINISHED,
103 ({ platform, errors }: { platform: string; errors: string[] }) => {
104 this.ui.updateCompilationProgress(platform, {
105 running: false,
106 value: 1,
107 });
108 errors.forEach(error => {
109 this.ui.addLogItem(

Callers 1

listenMethod · 0.95

Calls 2

addLogItemMethod · 0.65

Tested by

no test coverage detected