MCPcopy Index your code
hub / github.com/rollup/rollup / waitForInputPlugin

Function waitForInputPlugin

cli/run/waitForInput.ts:5–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { stderr } from '../logging';
4
5export function waitForInputPlugin(): Plugin {
6 return {
7 async buildStart(this: PluginContext, options: NormalizedInputOptions) {
8 const inputSpecifiers = Array.isArray(options.input)
9 ? options.input
10 : Object.keys(options.input);
11
12 let lastAwaitedSpecifier: string | null = null;
13 checkSpecifiers: while (true) {
14 for (const specifier of inputSpecifiers) {
15 if ((await this.resolve(specifier)) === null) {
16 if (lastAwaitedSpecifier !== specifier) {
17 stderr(`waiting for input ${bold(specifier)}...`);
18 lastAwaitedSpecifier = specifier;
19 }
20 await new Promise(resolve => setTimeout(resolve, 500));
21 continue checkSpecifiers;
22 }
23 }
24 break;
25 }
26 },
27 name: 'wait-for-input'
28 };
29}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…