How to use the @parcel/workers.bus.on function in @parcel/workers

To help you get started, we’ve selected a few @parcel/workers 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 parcel-bundler / parcel / packages / core / core / src / ReporterRunner.js View on Github external
constructor(opts: Opts) {
    this.config = opts.config;
    this.options = opts.options;
    this.pluginOptions = new PluginOptions(this.options);

    logger.onLog(event => this.report(event));

    // Convert any internal bundles back to their public equivalents as reporting
    // is public api
    bus.on('reporterEvent', event => {
      if (event.bundle == null) {
        this.report(event);
      } else {
        this.report({
          ...event,
          bundle: new NamedBundle(
            event.bundle,
            event.bundleGraph,
            this.options,
          ),
        });
      }
    });

    if (this.options.patchConsole) {
      patchConsole();