How to use the @haul-bundler/core-legacy/build/compiler/Compiler.Events function in @haul-bundler/core-legacy

To help you get started, we’ve selected a few @haul-bundler/core-legacy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github callstack / haul / packages / haul-core / src / server / setupCompilerRoutes.ts View on Github external
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 {
github callstack / haul / packages / haul-core / src / server / Server.ts View on Github external
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;
  }
github callstack / haul / packages / haul-core / src / server / Server.ts View on Github external
{
        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,
        });
      }

@haul-bundler/core-legacy

Haul core library (legacy)

MIT
Latest version published 4 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages