How to use the @parcel/workers.default 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 / parcel-bundler / src / Bundler.js View on Github external
const fs = require('@parcel/fs');
const Resolver = require('./Resolver');
const Parser = require('./Parser');
const WorkerFarm = require('@parcel/workers').default;
const Path = require('path');
const Bundle = require('./Bundle');
const Watcher = require('@parcel/watcher').default;
const FSCache = require('./FSCache');
const HMRServer = require('./HMRServer');
const Server = require('./Server');
const {EventEmitter} = require('events');
const logger = require('@parcel/logger');
const PackagerRegistry = require('./packagers');
const localRequire = require('./utils/localRequire');
const config = require('./utils/config');
const loadEnv = require('./utils/env');
const PromiseQueue = require('./utils/PromiseQueue');
const installPackage = require('./utils/installPackage');
const bundleReport = require('./utils/bundleReport');
const prettifyTime = require('./utils/prettifyTime');
github parcel-bundler / parcel / packages / core / parcel-bundler / src / utils / installPackage.js View on Github external
const config = require('./config');
const resolve = require('@parcel/utils/src/resolve').default;
const commandExists = require('command-exists');
const logger = require('@parcel/logger');
const pipeSpawn = require('./pipeSpawn');
const PromiseQueue = require('./PromiseQueue');
const path = require('path');
const fs = require('@parcel/fs');
const WorkerFarm = require('@parcel/workers').default;

const YARN_LOCK = 'yarn.lock';

async function install(modules, filepath, options = {}) {
  let {installPeers = true, saveDev = true, packageManager} = options;
  if (typeof modules === 'string') {
    modules = [modules];
  }

  logger.progress(`Installing ${modules.join(', ')}...`);

  let packageLocation = await config.resolve(filepath, ['package.json']);
  let cwd = packageLocation ? path.dirname(packageLocation) : process.cwd();

  if (!packageManager) {
    packageManager = await determinePackageManager(filepath);