Skip to content

Commit 23a19c8

Browse files
committed
docs(en): fix conflicts part 2
1 parent 9355d78 commit 23a19c8

File tree

85 files changed

+281
-3798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+281
-3798
lines changed

src/content/api/plugins.md

+4-43
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ T> 关于编写插件的高级介绍,请移步:
2323
让我们首先从 tapable 工具开始,
2424
它为 webpack 插件接口提供了核心能力的。
2525

26-
<<<<<<< HEAD
27-
2826
## Tapable {#tapable}
29-
=======
30-
## Tapable
31-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
3227

3328
这个小型库是 webpack 的一个核心工具,但也可用于其他地方,
3429
以提供类似的插件接口。
@@ -42,12 +37,7 @@ T> 关于编写插件的高级介绍,请移步:
4237
那些扩展自 `Tapable` 的对象(例如:compiler),
4338
以及其提供的钩子(hooks)和每个钩子的类型(例如:`同步钩子(SyncHook)`)值得关注。
4439

45-
<<<<<<< HEAD
46-
4740
## 插件类型 {#plugin-types}
48-
=======
49-
## Plugin Types
50-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
5141

5242
根据使用不同的钩子(hooks)和 `tap` 方法,
5343
插件可以以多种不同的方式运行。
@@ -59,72 +49,43 @@ T> 关于编写插件的高级介绍,请移步:
5949
插件可能会以不同的方式运行。
6050
例如:当你钩入到 `编译(compile)` 阶段时,只有同步的 `tap` 方法可以使用。
6151

62-
<<<<<<< HEAD
6352
``` js
64-
compiler.hooks.compile.tap('MyPlugin', params => {
65-
console.log('以同步方式触及 compile 钩子。');
66-
=======
67-
```js
6853
compiler.hooks.compile.tap('MyPlugin', (params) => {
69-
console.log('Synchronously tapping the compile hook.');
70-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
54+
console.log('以同步方式触及 compile 钩子。');
7155
});
7256
```
7357

7458
然而,对于可以使用 `AsyncHook``run` 阶段,
7559
则需使用 `tapAsync``tapPromise`(以及 `tap`)方法。
7660

7761
```js
78-
<<<<<<< HEAD
79-
compiler.hooks.run.tapAsync('MyPlugin', (source, target, routesList, callback) => {
80-
console.log('以异步方式触及 run 钩子。');
81-
callback();
82-
});
83-
84-
compiler.hooks.run.tapPromise('MyPlugin', (source, target, routesList) => {
85-
return new Promise(resolve => setTimeout(resolve, 1000)).then(() => {
86-
console.log('以具有延迟的异步方式触及 run 钩子。');
87-
});
88-
});
89-
90-
compiler.hooks.run.tapPromise('MyPlugin', async (source, target, routesList) => {
91-
await new Promise(resolve => setTimeout(resolve, 1000));
92-
console.log('以具有延迟的异步方式触及 run 钩子。');
93-
});
94-
=======
9562
compiler.hooks.run.tapAsync(
9663
'MyPlugin',
9764
(source, target, routesList, callback) => {
98-
console.log('Asynchronously tapping the run hook.');
65+
console.log('以异步方式触及运行钩子。');
9966
callback();
10067
}
10168
);
10269

10370
compiler.hooks.run.tapPromise('MyPlugin', (source, target, routesList) => {
10471
return new Promise((resolve) => setTimeout(resolve, 1000)).then(() => {
105-
console.log('Asynchronously tapping the run hook with a delay.');
72+
console.log('以异步的方式触发具有延迟操作的钩子。');
10673
});
10774
});
10875

10976
compiler.hooks.run.tapPromise(
11077
'MyPlugin',
11178
async (source, target, routesList) => {
11279
await new Promise((resolve) => setTimeout(resolve, 1000));
113-
console.log('Asynchronously tapping the run hook with a delay.');
80+
console.log('以异步的方式触发具有延迟操作的钩子。');
11481
}
11582
);
116-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
11783
```
11884

11985
这些需求(story)的含义在于,
12086
我们可以有多种方式 hook 到 compiler 中,可以让各种插件都以合适的方式去运行。
12187

122-
<<<<<<< HEAD
123-
12488
## 自定义钩子 {#custom-hooks}
125-
=======
126-
## Custom Hooks
127-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
12889

12990
为了便于其他插件的编译过程中可以 `tap` 到,则需要创建一个新的 hook,
13091
我们只需要简单的从 `tapable``require` 所需的 hook 类,并创建:

src/content/api/resolvers.md

-10
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ contributors:
1616
在继续阅读之前,请确保你已经读过
1717
[`enhanced-resolve`](https://github.com/webpack/enhanced-resolve)[`tapable`](/api/plugins/#tapable) 文档。
1818

19-
<<<<<<< HEAD
20-
2119
## 类型 {#types}
22-
=======
23-
## Types
24-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
2520

2621
`compiler` 类中,提供了三种类型的内置解析器:
2722

@@ -47,12 +42,7 @@ compiler.resolverFactory.hooks.resolver
4742

4843
请参阅 [`enhanced-resolve` documentation](https://github.com/webpack/enhanced-resolve) 以获得钩子的完整列表以及它们的介绍。
4944

50-
<<<<<<< HEAD
51-
5245
## 配置选项 {#configuration-options}
53-
=======
54-
## Configuration Options
55-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
5646

5747
上述解析器也可以
5848
利用 [`resolve`](/configuration/resolve/) or [`resolveLoader`](/configuration/resolve/#resolveloader) 选项,通过配置文件进行定制。这些选项允许

src/content/api/stats.mdx

-20
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ npx webpack --profile --json=compilation-stats.json
2020

2121
The `--json=compilation-stats.json` flag indicates to webpack that it should emit the `compilation-stats.json` containing the dependency graph and various other build information. Typically, the `--profile` flag is also added so that a `profile` section is added to each [`modules` object](#module-objects) containing module-specific compilation stats.
2222

23-
<<<<<<< HEAD
24-
2523
## Structure {#structure}
26-
=======
27-
## Structure
28-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
2924

3025
The top-level structure of the output JSON file is fairly straightforward but there are a few nested data structures as well. Each nested structure has a dedicated section below to make this document more consumable. Note that you can click links within the top-level structure below to jump to relevant sections and documentation:
3126

@@ -72,12 +67,7 @@ The top-level structure of the output JSON file is fairly straightforward but th
7267
}
7368
```
7469

75-
<<<<<<< HEAD
76-
7770
### Asset Objects {#asset-objects}
78-
=======
79-
### Asset Objects
80-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
8171

8272
Each `assets` object represents an `output` file emitted from the compilation. They all follow a similar structure:
8373

@@ -104,12 +94,7 @@ Each `assets` object represents an `output` file emitted from the compilation. T
10494

10595
T> Asset's `info` property is available since webpack v4.40.0
10696

107-
<<<<<<< HEAD
108-
10997
### Chunk Objects {#chunk-objects}
110-
=======
111-
### Chunk Objects
112-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
11398

11499
Each `chunks` object represents a group of modules known as a [chunk](/glossary/#c). Each object follows the following structure:
115100

@@ -154,12 +139,7 @@ The `chunks` object will also contain a list of `origins` describing how the giv
154139
}
155140
```
156141

157-
<<<<<<< HEAD
158-
159142
### Module Objects {#module-objects}
160-
=======
161-
### Module Objects
162-
>>>>>>> 2a79b6b70d9af5bbff0bb3f044dcb2d575090ce5
163143

164144
What good would these statistics be without some description of the compiled application's actual modules? Each module in the dependency graph is represented by the following structure:
165145

0 commit comments

Comments
 (0)