How to use the @haul-bundler/core.Runtime function in @haul-bundler/core

To help you get started, we’ve selected a few @haul-bundler/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 callstack / haul / packages / haul-core-legacy / src / commands / bundle.js View on Github external
async function bundle(opts: *) {
  const directory = process.cwd();
  // Need to add @babel/register to support ES2015+ in config file.
  require('../babelRegister');
  const configPath = getProjectConfigPath(directory, opts.config);
  const projectConfig = getProjectConfig(configPath);
  const config = getWebpackConfig(
    new Runtime(),
    {
      platform: opts.platform,
      root: directory,
      dev: opts.dev,
      minify: opts.minify,
      bundle: true,
    },
    projectConfig
  );

  if (opts.assetsDest) {
    config.output.path = path.isAbsolute(opts.assetsDest)
      ? opts.assetsDest
      : path.join(directory, opts.assetsDest);
  }
github callstack / haul / packages / haul-cli / src / main.ts View on Github external
export default async function main() {
  const {
    HAUL_INSPECTOR,
    HAUL_INSPECTOR_PORT,
    HAUL_INSPECTOR_HOST,
    NODE_INSPECTOR,
  } = process.env;
  let { haulInspector, nodeInspector } = yargsParser(process.argv);
  haulInspector = haulInspector || HAUL_INSPECTOR;
  nodeInspector = nodeInspector || NODE_INSPECTOR;

  const runtime = new Runtime(
    haulInspector || HAUL_INSPECTOR_PORT || HAUL_INSPECTOR_HOST
      ? new InspectorClient(HAUL_INSPECTOR_HOST, HAUL_INSPECTOR_PORT)
      : undefined
  );

  await runtime.ready(haulInspector === 'wait');

  // Experimental
  if (nodeInspector) {
    const wait = nodeInspector === 'wait';
    runtime.nodeInspectorStarted(wait);
    const inspector = require('inspector');
    inspector.open(undefined, undefined, wait);
  }

  [
github callstack / haul / packages / haul-core-legacy / src / compiler / worker / runWebpackCompiler.js View on Github external
module.exports = async function runWebpackCompiler({
  platform,
  options,
}: {
  [key: string]: any,
}) {
  const emitter = new EventEmitter();
  const { configPath, configOptions } = JSON.parse(options);

  const runtime = new Runtime();
  runtime.logger.proxy((level, ...args) => {
    setImmediate(() => {
      emitter.emit(Events.LOG, {
        message: runtime.logger.stringify(args).join(' '),
        level,
      });
    });
  });

  const outputPath = configOptions.assetsDest;
  const projectConfig = getNormalizedProjectConfigBuilder(runtime, configPath)(
    runtime,
    {
      ...configOptions,
      platform,
    }