How to use the @parcel/watcher.writeSnapshot function in @parcel/watcher

To help you get started, we’ve selected a few @parcel/watcher 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 astronomersiva / lego / lib / tasks / copyMinorStaticAssets.js View on Github external
// This watcher needs a newer version of libc6

        parcelWatcher = require('@parcel/watcher');
        await parcelWatcher.writeSnapshot(STATIC, snapshotPath);
      }

      minorStaticFiles = staticFiles.filter((path) => !['css', 'js'].includes(path));
    } else {
      if (['add', 'change'].includes(event)) {
        minorStaticFiles = [path.replace(`${STATIC}/`, '')];
      } else if (event === 'unlink') {
        fs.remove(`${BUILD}/${path}`);
      }

      let parcelWatcher = require('@parcel/watcher');
      await parcelWatcher.writeSnapshot(STATIC, snapshotPath);
    }

    let copyPromises = [];
    for (const asset of minorStaticFiles) {
      copyPromises.push(
        fs.copy(
          `${STATIC}/${asset}`,
          `${BUILD}/${STATIC}/${asset}`
        )
      );
    }

    await Promise.all(copyPromises);
    logger.timeEnd(message);
  } catch (error) {
    throw error;
github parcel-bundler / parcel / packages / core / fs / src / NodeFS.js View on Github external
async writeSnapshot(
    dir: FilePath,
    snapshot: FilePath,
    opts: WatcherOptions,
  ): Promise {
    await watcher.writeSnapshot(dir, snapshot, opts);
  }

@parcel/watcher

A native C++ Node module for querying and subscribing to filesystem events. Used by Parcel 2.

MIT
Latest version published 8 months ago

Package Health Score

80 / 100
Full package analysis

Similar packages