Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed May 10, 2020
1 parent 6b04d40 commit f522f5b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/01-command-line-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export default { // can be an array (for multiple inputs)
},

watch: {
buildDelay,
chokidar,
clearScreen,
skipWrite,
Expand Down
1 change: 1 addition & 0 deletions docs/02-javascript-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ const watchOptions = {
...inputOptions,
output: [outputOptions],
watch: {
buildDelay,
chokidar,
clearScreen,
skipWrite,
Expand Down
14 changes: 8 additions & 6 deletions docs/999-big-list-of-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -1222,28 +1222,31 @@ For each key, the first number represents the elapsed time while the second repr

These options only take effect when running Rollup with the `--watch` flag, or using `rollup.watch`.

#### watch.buildDelay
Type: `number`<br>
Default: `0`

Configures how long Rollup will wait for further changes until it triggers a rebuild in milliseconds. By default, Rollup does not wait but there is a small debounce timeout configured in the chokidar instance. Setting this to a value greater than `0` will mean that Rollup will only triger a rebuild if there was no change for the configured number of milliseconds.

#### watch.chokidar
Type: `ChokidarOptions`<br>

An optional object of watch options that will be passed to the bundled [chokidar](https://github.com/paulmillr/chokidar) instance. See the [chokidar documentation](https://github.com/paulmillr/chokidar#api) to find out what options are available.

#### watch.clearScreen
Type: `boolean`<br>
CLI: `--watch.clearScreen`/`--no-watch.clearScreen`<br>
Default: `true`

Whether to clear the screen when a rebuild is triggered.

#### watch.skipWrite
Type: `boolean`<br>
<!-- CLI: `--watch.skipWrite`<br> -->
Default: `false`

Whether to skip the `bundle.write()` step when a rebuild is triggered.

#### watch.exclude
Type: `string`<br>
CLI: `--watch.exclude <excludedPattern>`
Type: `string`

Prevent files from being watched:

Expand All @@ -1258,8 +1261,7 @@ export default {
```

#### watch.include
Type: `string`<br>
CLI: `--watch.include <includedPattern>`
Type: `string`

Limit the file-watching to certain files:

Expand Down
2 changes: 1 addition & 1 deletion src/rollup/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ export interface ChokidarOptions {
}

export interface WatcherOptions {
buildDelay?: number;
chokidar?: ChokidarOptions;
clearScreen?: boolean;
exclude?: string[];
Expand Down Expand Up @@ -674,7 +675,6 @@ export interface RollupWatcher
event: (event: RollupWatcherEvent) => void;
restart: () => void;
}> {
delay?: number;
close(): void;
}

Expand Down
2 changes: 1 addition & 1 deletion src/watch/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class Watcher {
this.buildDelay = configArray.reduce(
(buildDelay, { watch }: any) =>
watch && typeof watch.buildDelay === 'number'
? Math.max(buildDelay, watch.buildDelay)
? Math.max(buildDelay, (watch as WatcherOptions).buildDelay!)
: buildDelay,
this.buildDelay
);
Expand Down

0 comments on commit f522f5b

Please sign in to comment.