How to use @parcel/cache - 2 common examples

To help you get started, we’ve selected a few @parcel/cache 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 / resolveOptions.js View on Github external
let lockFile = null;
  let rootFileName = path.basename(projectRootFile);
  if (LOCK_FILE_NAMES.includes(rootFileName)) {
    lockFile = projectRootFile;
  }
  let projectRoot = path.dirname(projectRootFile);

  let outputCwd = outputFS.cwd();
  let cacheDir =
    // If a cacheDir is provided, resolve it relative to cwd. Otherwise,
    // use a default directory resolved relative to the project root.
    initialOptions.cacheDir != null
      ? path.resolve(outputCwd, initialOptions.cacheDir)
      : path.resolve(projectRoot, DEFAULT_CACHE_DIRNAME);

  let cache = new Cache(outputFS, cacheDir);

  let mode = initialOptions.mode ?? 'development';
  let minify = initialOptions.minify ?? mode === 'production';

  return {
    config: initialOptions.config,
    defaultConfig: initialOptions.defaultConfig,
    patchConsole:
      initialOptions.patchConsole ?? process.env.NODE_ENV !== 'test',
    env:
      initialOptions.env ??
      (await loadDotEnv(inputFS, path.join(projectRoot, 'index'))),
    mode,
    minify,
    autoinstall: initialOptions.autoinstall ?? true,
    hot: initialOptions.hot ?? false,
github parcel-bundler / parcel / packages / core / core / src / Parcel.js View on Github external
async init(): Promise {
    if (this.#initialized) {
      return;
    }

    let resolvedOptions: ParcelOptions = await resolveOptions(
      this.#initialOptions,
    );
    this.#resolvedOptions = resolvedOptions;
    await createCacheDir(resolvedOptions.outputFS, resolvedOptions.cacheDir);

    let {config} = await loadParcelConfig(
      path.join(resolvedOptions.inputFS.cwd(), 'index'),
      resolvedOptions,
    );
    this.#config = config;
    this.#farm =
      this.#initialOptions.workerFarm ??
      createWorkerFarm({
        patchConsole: resolvedOptions.patchConsole,
      });

    this.#assetGraphBuilder = new AssetGraphBuilder();
    this.#runtimesAssetGraphBuilder = new AssetGraphBuilder();

    await Promise.all([

@parcel/cache

MIT
Latest version published 2 months ago

Package Health Score

94 / 100
Full package analysis

Popular @parcel/cache functions

Similar packages