How to use the @parcel/logger.clear 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 / src / core / core / src / Bundler.js View on Github external
async bundle() {
    // If another bundle is already pending, wait for that one to finish and retry.
    if (this.pending) {
      return new Promise((resolve, reject) => {
        this.once('buildEnd', () => {
          this.bundle().then(resolve, reject);
        });
      });
    }

    let isInitialBundle = !this.entryAssets;
    let startTime = Date.now();
    this.pending = true;
    this.error = null;

    logger.clear();
    logger.progress('Building...');

    try {
      // Start worker farm, watcher, etc. if needed
      await this.start();

      // Emit start event, after bundler is initialised
      this.emit('buildStart', this.entryFiles);

      // If this is the initial bundle, ensure the output directory exists, and resolve the main asset.
      if (isInitialBundle) {
        await fs.mkdirp(this.options.outDir);

        this.entryAssets = new Set();
        for (let entry of this.entryFiles) {
          let asset = await this.resolveAsset(entry);
github parcel-bundler / parcel / packages / core / parcel-bundler / src / Bundler.js View on Github external
// If another bundle is already pending, wait for that one to finish and retry.
    if (this.pending) {
      return new Promise((resolve, reject) => {
        this.once('buildEnd', () => {
          this.bundle().then(resolve, reject);
        });
      });
    }

    let isInitialBundle = !this.entryAssets;
    let startTime = Date.now();
    let initialised = !isInitialBundle;
    this.pending = true;
    this.error = null;

    logger.clear();
    logger.progress('Building...');

    try {
      // Start worker farm, watcher, etc. if needed
      await this.start();

      // Emit start event, after bundler is initialised
      this.emit('buildStart', this.entryFiles);

      // If this is the initial bundle, ensure the output directory exists, and resolve the main asset.
      if (isInitialBundle) {
        await fs.mkdirp(this.options.outDir);

        this.entryAssets = new Set();
        for (let entry of this.entryFiles) {
          try {
github 101arrowz / pwa-manifest / packages / parcel-plugin-pwa-manifest / index.ts View on Github external
bundler.on('bundled', async bundle => {
    try {
      return await onBundled(bundle);
    } catch (msg) /* istanbul ignore next */ {
      logger.clear();
      logger.error('Manifest creation failed! ' + msg);
    }
  });
};
github parcel-bundler / parcel / src / core / core / src / Bundler.js View on Github external
async onChange(path) {
    let assets = this.watchedAssets.get(path);
    if (!assets || !assets.size) {
      return;
    }

    logger.clear();
    logger.progress(`Building ${Path.basename(path)}...`);

    // Add the asset to the rebuild queue, and reset the timeout.
    for (let asset of assets) {
      this.buildQueue.add(asset, true);
    }

    clearTimeout(this.rebuildTimeout);

    this.rebuildTimeout = setTimeout(async () => {
      await this.bundle();
    }, 100);
  }
github parcel-bundler / parcel / packages / core / parcel-bundler / src / Bundler.js View on Github external
async onChange(path) {
    // The path to the newly-added items are not absolute.
    if (!Path.isAbsolute(path)) {
      path = Path.resolve(process.cwd(), path);
    }

    let assets = this.watchedAssets.get(path);
    if (!assets || !assets.size) {
      return;
    }

    logger.clear();
    logger.progress(`Building ${Path.basename(path)}...`);

    // Add the asset to the rebuild queue, and reset the timeout.
    for (let asset of assets) {
      this.buildQueue.add(asset, true);
    }

    clearTimeout(this.rebuildTimeout);

    this.rebuildTimeout = setTimeout(async () => {
      await this.bundle();
    }, 100);
  }