How to use the @parcel/core function in @parcel/core

To help you get started, we’ve selected a few @parcel/core 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 / test-utils / src / utils.js View on Github external
export function bundler(
  entries: FilePath | Array,
  opts?: InitialParcelOptions,
) {
  return new Parcel({
    entries,
    disableCache: true,
    logLevel: 'none',
    defaultConfig,
    inputFS,
    outputFS,
    workerFarm,
    packageManager: new NodePackageManager(inputFS),
    defaultEngines: {
      browsers: ['last 1 Chrome version'],
      node: '8',
    },
    // $FlowFixMe
    ...opts,
  });
}
github parcel-bundler / parcel / packages / core / register / src / hook.js View on Github external
export default function register(opts = DEFAULT_CLI_OPTS) {
  // Replace old hook, as this one likely contains options.
  if (hooks) {
    for (let extension in hooks) {
      hooks[extension]();
    }
  }

  let parcel = new Parcel({
    entries: [path.join(process.cwd(), 'index.js')],
    cliOpts: opts
  });

  let environment = new Environment({
    context: 'node',
    engines: {
      node: process.versions.node
    }
  });

  syncPromise(parcel.init());

  let isProcessing = false;

  // As Parcel is pretty much fully asynchronous, create an async function and wrap it in a syncPromise later...
github parcel-bundler / parcel / packages / core / register / src / register.js View on Github external
function register(inputOpts?: InitialParcelOptions): IDisposable {
  let opts: InitialParcelOptions = {
    ...defaultConfig,
    ...(inputOpts || {}),
  };

  // Replace old hook, as this one likely contains options.
  if (lastDisposable) {
    lastDisposable.dispose();
  }

  let parcel = new Parcel({
    logLevel: 'error',
    ...opts,
  });

  let env = {
    context: 'node',
    engines: {
      node: process.versions.node,
    },
  };

  syncPromise(parcel.init());

  let isProcessing = false;

  // As Parcel is pretty much fully asynchronous, create an async function and wrap it in a syncPromise later...

@parcel/core

MIT
Latest version published 6 days ago

Package Health Score

94 / 100
Full package analysis