How to use the @parcel/logger.log function in @parcel/logger

To help you get started, we’ve selected a few @parcel/logger 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 / package-manager / src / Npm.js View on Github external
await promiseFromProcess(installProcess);

      let results: NPMResults = JSON.parse(stdout);
      let addedCount = results.added.length;
      if (addedCount > 0) {
        logger.log({
          origin: '@parcel/package-manager',
          message: `Added ${addedCount} packages via npm`,
        });
      }

      // Since we succeeded, stderr might have useful information not included
      // in the json written to stdout. It's also not necessary to log these as
      // errors as they often aren't.
      for (let message of stderr) {
        logger.log({
          origin: '@parcel/package-manager',
          message,
        });
      }
    } catch (e) {
      throw new Error('npm failed to install modules');
    }
  }
}
github adobe / helix-cli / src / parcel / HelixAsset.js View on Github external
getPreprocessor(name, fallback) {
    if (fs.existsSync(name)) {
      // ensure forward slashes (windows)
      return path.relative(this.name, name).substr(1).replace(/\\/g, '/');
    }
    try {
      if (require.resolve(fallback)) {
        return fallback;
      }
    } catch (e) {
      logger.log(`${fallback} cannot be found, using default pipeline`);
    }

    return DEFAULT_PIPELINE;
  }
github parcel-bundler / parcel / packages / core / parcel-bundler / src / utils / bundleReport.js View on Github external
'└── ' +
            logger.chalk.dim(
              `+ ${assets.length - largestAssets.length} more assets`,
            ),
        ]);
      }

      // If this isn't the last bundle, add an empty row before the next one
      if (bundle !== bundles[bundles.length - 1]) {
        rows.push([]);
      }
    }
  }

  // Render table
  logger.log('');
  logger.table(COLUMNS, rows);
}
github chrisdmacrae / parceleventy / lib / parcel / parcel-plugin-service-worker / lib / ServiceWorker.js View on Github external
globPatterns: [
                '**/*.{js,css,html,png,jpg,jpeg,gif,tiff}'
                ],
                importWorkboxFrom: 'disabled',
                importScripts: [],
                swDest: destination
            }
            const cfg = Object.assign(defaultConfig, config);

            cfg.importScripts = cfg.importScripts.concat(this.importScripts);

            logger.progress('Creating service worker...');

            await workbox.generateSW(cfg);

            logger.log('Service worker generated at: ' + cfg.swDest);
        } catch (error) {
            throw error;
        }
    }
github parcel-bundler / parcel / packages / reporters / dev-server / src / Server.js View on Github external
this.server.once('listening', () => {
        let addon =
          this.server.address().port !== this.options.port
            ? `- configured port ${this.options.port.toString()} could not be used.`
            : '';

        logger.log(
          `Server running at ${this.options.https ? 'https' : 'http'}://${this
            .options.host || 'localhost'}:${
            this.server.address().port
          } ${addon}`
        );

        resolve(this.server);
      });
    });
github chrisdmacrae / parceleventy / lib / parcel / parcel-plugin-service-worker / lib / ServiceWorker.js View on Github external
globPatterns: [
                '**/*.{js,css,html,png,jpg,jpeg,gif,tiff}'
                ],
                swSrc: destination + ".tmp",
                swDest: destination
            }
            const cfg = Object.assign(defaultConfig, config);

            logger.progress('Injecting service worker manifest...');

            fs.copySync(cfg.swDest, cfg.swDest + ".tmp");

            let { count, size } = await workbox.injectManifest(cfg);
            fs.unlinkSync(cfg.swDest + ".tmp");

            logger.log('Service worker manifest injected at: ' + cfg.swDest);
            logger.log(`Will precache ${count} files, totaling ${size} bytes.`);
        } catch (error) {
            throw error;
        }
    }
github chrisdmacrae / parceleventy / lib / parcel / parcel-plugin-service-worker / lib / ServiceWorker.js View on Github external
'**/*.{js,css,html,png,jpg,jpeg,gif,tiff}'
                ],
                swSrc: destination + ".tmp",
                swDest: destination
            }
            const cfg = Object.assign(defaultConfig, config);

            logger.progress('Injecting service worker manifest...');

            fs.copySync(cfg.swDest, cfg.swDest + ".tmp");

            let { count, size } = await workbox.injectManifest(cfg);
            fs.unlinkSync(cfg.swDest + ".tmp");

            logger.log('Service worker manifest injected at: ' + cfg.swDest);
            logger.log(`Will precache ${count} files, totaling ${size} bytes.`);
        } catch (error) {
            throw error;
        }
    }