rolldown-BLMDGLfI.mjs 986 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-DtGk-m96.mjs";
  2. //#region src/api/rolldown/index.ts
  3. /**
  4. * The API compatible with Rollup's `rollup` function.
  5. *
  6. * Unlike Rollup, the module graph is not built until the methods of the bundle object are called.
  7. *
  8. * @param input The input options object.
  9. * @returns A Promise that resolves to a bundle object.
  10. *
  11. * @example
  12. * ```js
  13. * import { rolldown } from 'rolldown';
  14. *
  15. * let bundle, failed = false;
  16. * try {
  17. * bundle = await rolldown({
  18. * input: 'src/main.js',
  19. * });
  20. * await bundle.write({
  21. * format: 'esm',
  22. * });
  23. * } catch (e) {
  24. * console.error(e);
  25. * failed = true;
  26. * }
  27. * if (bundle) {
  28. * await bundle.close();
  29. * }
  30. * process.exitCode = failed ? 1 : 0;
  31. * ```
  32. *
  33. * @category Programmatic APIs
  34. */
  35. const rolldown = async (input) => {
  36. validateOption("input", input);
  37. return new RolldownBuild(await PluginDriver.callOptionsHook(input));
  38. };
  39. //#endregion
  40. export { rolldown as t };