Skip to content

docs: avoid code in heading #5297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 25, 2021
116 changes: 58 additions & 58 deletions src/content/api/compilation-hooks.mdx

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions src/content/api/compiler-hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ Depending on the hook type, `tapAsync` and `tapPromise` may also be available.

For the description of hook types, see [the Tapable docs](https://github.com/webpack/tapable#tapable).

### `environment`
### environment

`SyncHook`

Called while preparing the compiler environment, right after initializing the plugins in the configuration file.

### `afterEnvironment`
### afterEnvironment

`SyncHook`

Called right after the `environment` hook, when the compiler environment setup is complete.

### `entryOption`
### entryOption

`SyncBailHook`

Expand All @@ -70,69 +70,69 @@ compiler.hooks.entryOption.tap('MyPlugin', (context, entry) => {
});
```

### `afterPlugins`
### afterPlugins

`SyncHook`

Called after setting up initial set of internal plugins.

- Callback Parameters: `compiler`

### `afterResolvers`
### afterResolvers

`SyncHook`

Triggered after resolver setup is complete.

- Callback Parameters: `compiler`

### `initialize`
### initialize

`SyncHook`

Called when a compiler object is initialized.

### `beforeRun`
### beforeRun

`AsyncSeriesHook`

Adds a hook right before running the compiler.

- Callback Parameters: `compiler`

### `run`
### run

`AsyncSeriesHook`

Hook into the compiler before it begins reading [`records`](/configuration/other-options/#recordspath).

- Callback Parameters: `compiler`

### `watchRun`
### watchRun

`AsyncSeriesHook`

Executes a plugin during watch mode after a new compilation is triggered but before the compilation is actually started.

- Callback Parameters: `compiler`

### `normalModuleFactory`
### normalModuleFactory

`SyncHook`

Called after a [NormalModuleFactory](/api/normalmodulefactory-hooks) is created.

- Callback Parameters: `normalModuleFactory`

### `contextModuleFactory`
### contextModuleFactory

`SyncHook`

Runs a plugin after a [ContextModuleFactory](/api/contextmodulefactory-hooks) is created.

- Callback Parameters: `contextModuleFactory`

### `beforeCompile`
### beforeCompile

`AsyncSeriesHook`

Expand All @@ -158,47 +158,47 @@ compiler.hooks.beforeCompile.tapAsync('MyPlugin', (params, callback) => {
});
```

### `compile`
### compile

`SyncHook`

Called right after `beforeCompile`, before a new compilation is created.

- Callback Parameters: `compilationParams`

### `thisCompilation`
### thisCompilation

`SyncHook`

Executed while initializing the compilation, right before emitting the `compilation` event.

- Callback Parameters: `compilation`, `compilationParams`

### `compilation`
### compilation

`SyncHook`

Runs a plugin after a compilation has been created.

- Callback Parameters: `compilation`, `compilationParams`

### `make`
### make

`AsyncParallelHook`

Executed before finishing the compilation.

- Callback Parameters: `compilation`

### `afterCompile`
### afterCompile

`AsyncSeriesHook`

Called after finishing and sealing the compilation.

- Callback Parameters: `compilation`

### `shouldEmit`
### shouldEmit

`SyncBailHook`

Expand All @@ -213,23 +213,23 @@ compiler.hooks.shouldEmit.tap('MyPlugin', (compilation) => {
});
```

### `emit`
### emit

`AsyncSeriesHook`

Executed right before emitting assets to output dir.

- Callback Parameters: `compilation`

### `afterEmit`
### afterEmit

`AsyncSeriesHook`

Called after emitting assets to output directory.

- Callback Parameters: `compilation`

### `assetEmitted`
### assetEmitted

`AsyncSeriesHook`

Expand All @@ -248,51 +248,51 @@ compiler.hooks.assetEmitted.tap(
);
```

### `done`
### done

`AsyncSeriesHook`

Executed when the compilation has completed.

- Callback Parameters: `stats`

### `additionalPass`
### additionalPass

`AsyncSeriesHook`

This hook allows you to do a one more additional pass of the build.

### `failed`
### failed

`SyncHook`

Called if the compilation fails.

- Callback Parameters: `error`

### `invalid`
### invalid

`SyncHook`

Executed when a watching compilation has been invalidated.

- Callback Parameters: `fileName`, `changeTime`

### `watchClose`
### watchClose

`SyncHook`

Called when a watching compilation has stopped.

### `infrastructureLog`
### infrastructureLog

`SyncBailHook`

Allows to use infrastructure logging when enabled in the configuration via [`infrastructureLogging` option](/configuration/other-options/#infrastructurelogging).

- Callback Parameters: `name`, `type`, `args`

### `log`
### log

`SyncBailHook`

Expand Down
24 changes: 12 additions & 12 deletions src/content/api/hot-module-replacement.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The following methods are supported...

## Module API

### `accept`
### accept

Accept updates for the given `dependencies` and fire a `callback` to react to those updates, in addition, you can attach an optional error handler:

Expand Down Expand Up @@ -69,7 +69,7 @@ When using CommonJS you need to update dependencies manually by using `require()
- `moduleId`: the current module id.
- `dependencyId`: the module id of the (first) changed dependency.

### `accept` (self)
### accept (self)

Accept updates for itself.

Expand Down Expand Up @@ -98,7 +98,7 @@ The `errorHandler` is fired when the evaluation of this module (or dependencies)
- `module.hot`: allow to use the HMR API of the errored module instance. A common scenario is to self accept it again. It also makes sense to add a dispose handler to pass data along. Note that the errored module might be already partially executed, so make sure to not get into a inconsistent state. You can use `module.hot.data` to store partial state.
- `module.exports`: can be overridden, but be careful since property names might be mangled in production mode.

### `decline`
### decline

Reject updates for the given `dependencies` forcing the update to fail with a `'decline'` code.

Expand All @@ -115,7 +115,7 @@ import.meta.webpackHot.decline(

Flag a dependency as not-update-able. This makes sense when changing exports of this dependency can't be handled or handling is not implemented yet. Depending on your HMR management code, an update to these dependencies (or unaccepted dependencies of it) usually causes a full-reload of the page.

### `decline` (self)
### decline (self)

Reject updates for itself.

Expand All @@ -128,7 +128,7 @@ import.meta.webpackHot.decline();

Flag this module as not-update-able. This makes sense when this module has irreversible side-effects, or HMR handling is not implemented for this module yet. Depending on your HMR management code, an update to this module (or unaccepted dependencies) usually causes a full-reload of the page.

### `dispose` (or `addDisposeHandler`)
### dispose (or addDisposeHandler)

Add a handler which is executed when the current module code is replaced. This should be used to remove any persistent resource you have claimed or created. If you want to transfer state to the updated module, add it to the given `data` parameter. This object will be available at `module.hot.data` after the update.

Expand All @@ -143,7 +143,7 @@ import.meta.webpackHot.dispose((data) => {
});
```

### `invalidate`
### invalidate

Calling this method will invalidate the current module, which disposes and recreates it when the HMR update is applied. This bubbles like a normal update of this module. `invalidate` can't be self-accepted by this module.

Expand Down Expand Up @@ -220,7 +220,7 @@ T> When `invalidate` is called, the [`dispose`](#dispose-or-adddisposehandler) h

W> Do not get caught in an `invalidate` loop, by calling `invalidate` again and again. This will result in stack overflow and HMR entering the `fail` state.

### `removeDisposeHandler`
### removeDisposeHandler

Remove the handler added via `dispose` or `addDisposeHandler`.

Expand All @@ -233,7 +233,7 @@ import.meta.webpackHot.removeDisposeHandler(callback);

## Management API

### `status`
### status

Retrieve the current status of the hot module replacement process.

Expand All @@ -255,7 +255,7 @@ import.meta.webpackHot.status();
| abort | An update was aborted, but the system is still in its previous state |
| fail | An update has thrown an exception and the system's state has been compromised |

### `check`
### check

Test all loaded modules for updates and, if updates exist, `apply` them.

Expand All @@ -282,7 +282,7 @@ import.meta.webpackHot

The `autoApply` parameter can either be a boolean or `options` to pass to the `apply` method when called.

### `apply`
### apply

Continue the update process (as long as `module.hot.status() === 'ready'`).

Expand Down Expand Up @@ -340,7 +340,7 @@ The `info` parameter will be an object containing some of the following values:
}
```

### `addStatusHandler`
### addStatusHandler

Register a function to listen for changes in `status`.

Expand All @@ -357,7 +357,7 @@ import.meta.webpackHot.addStatusHandler((status) => {

Bear in mind that when the status handler returns a `Promise`, the HMR system will wait for the `Promise` to resolve before continuing.

### `removeStatusHandler`
### removeStatusHandler

Remove a registered status handler.

Expand Down
Loading