Skip to content

Commit 2ecad29

Browse files
Merge branch 'master' into types-plugins
2 parents 45ce532 + ad08df7 commit 2ecad29

29 files changed

+523
-493
lines changed

package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
"markdownlint-cli": "^0.13.0",
114114
"markdownlint-rule-emphasis-style": "^1.0.0",
115115
"marked": "0.6.1",
116-
"mermaid.cli": "^0.3.6",
117116
"mini-css-extract-plugin": "^0.5.0",
118117
"minimist": "1.2.0",
119118
"mkdirp": "^0.5.1",
@@ -125,16 +124,14 @@
125124
"postcss-loader": "^2.1.3",
126125
"redirect-webpack-plugin": "^0.1.1",
127126
"remark": "^10.0.1",
128-
"remark-autolink-headings": "^5.0.0",
127+
"remark-autolink-headings": "5.2.1",
129128
"remark-custom-blockquotes": "1.0.0",
130129
"remark-extract-anchors": "1.0.2",
131130
"remark-loader": "^0.3.0",
132-
"remark-mermaid": "^0.2.0",
133131
"remark-refractor": "1.1.0",
134132
"remark-responsive-tables": "1.0.0",
135133
"remark-slug": "^5.0.0",
136-
"request": "^2.81.0",
137-
"request-promise": "^4.2.2",
134+
"request-promise": "4.2.4",
138135
"rimraf": "^2.6.2",
139136
"sass-loader": "^6.0.6",
140137
"sirv-cli": "^0.1.2",
@@ -152,7 +149,6 @@
152149
"webpack-merge": "^4.1.0"
153150
},
154151
"dependencies": {
155-
"@rigor789/remark-autolink-headings": "^5.1.0",
156152
"ajv": "^5.5.2",
157153
"docsearch.js": "^2.5.2",
158154
"gitter-sidecar": "^1.2.3",
@@ -165,7 +161,7 @@
165161
"react-dom": "^16.8.6",
166162
"react-g-analytics": "0.4.2",
167163
"react-hot-loader": "^4.0.0-beta.12",
168-
"react-markdown": "4.0.4",
164+
"react-markdown": "4.2.2",
169165
"react-router-dom": "^4.2.2",
170166
"react-tiny-popover": "3.4.2",
171167
"react-visibility-sensor": "^5.0.2",

src/content/api/compilation-object.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,37 @@ Parameters:
322322
### checkConstraints
323323

324324
`function`
325+
326+
### emitAsset
327+
328+
`function (file, source, assetInfo = {})`
329+
330+
Parameters:
331+
332+
- `file` - file name of the asset
333+
- `source` - source of the asset
334+
- `assetInfo` - additional asset information
335+
336+
### updateAsset
337+
338+
`function (file, newSourceOrFunction, assetInfoUpdateOrFunction)`
339+
340+
Parameters:
341+
342+
- `file` - file name of the asset
343+
- `newSourceOrFunction` - new asset source or function converting old to new
344+
- `assetInfoUpdateOrFunction` - new asset info or function converting old to new
345+
346+
### getAssets
347+
348+
`function`
349+
350+
Returns array of all assets under current compilation.
351+
352+
### getAsset
353+
354+
`function (name)`
355+
356+
Parameters:
357+
358+
`name` - the name of the asset to return

src/content/concepts/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ For a better understanding of the ideas behind module bundlers and how they work
4747

4848
An __entry point__ indicates which module webpack should use to begin building out its internal [dependency graph](/concepts/dependency-graph/). webpack will figure out which other modules and libraries that entry point depends on (directly and indirectly).
4949

50-
By default its value is `./src/index.js`, but you can specify a different (or multiple entry points) by configuring the __entry__ property in the [webpack configuration](/configuration). For example:
50+
By default its value is `./src/index.js`, but you can specify a different (or multiple entry points) by setting an [`entry` property in the webpack configuration](/configuration/entry-context/#entry). For example:
5151

5252
__webpack.config.js__
5353

@@ -119,7 +119,7 @@ The configuration above has defined a `rules` property for a single module with
119119
120120
W> It is important to remember that when defining rules in your webpack config, you are defining them under `module.rules` and not `rules`. For your benefit, webpack will warn you if this is done incorrectly.
121121

122-
W> Keep in mind that when using regex to match files, you may not quote it. i.e `/\.txt$/` is not the same as `'/\.txt$/'` or `"/\.txt$/"`. The former instructs webpack to match any file that ends with .txt and the latter instructs webpack to match a single file with an absolute path '.txt'; this is likely not your intention.
122+
W> Keep in mind that when using regex to match files, you may not quote it. i.e `/\.txt$/` is not the same as `'/\.txt$/'` or `"/\.txt$/"`. The former instructs webpack to match any file that ends with .txt and the latter instructs webpack to match a single file with an absolute path '.txt'; this is likely not your intention.
123123

124124
You can check further customization when including loaders in the [loaders section](/concepts/loaders).
125125

src/content/concepts/module-resolution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You can replace the original module path by an alternate path by creating an ali
6161
Once the path is resolved based on the above rule, the resolver checks to see if the path points to a file or a directory. If the path points to a file:
6262

6363
- If the path has a file extension, then the file is bundled straightaway.
64-
- Otherwise, the file extension is resolved using the [`resolve.extensions`](/configuration/resolve/#resolveextensions) option, which tells the resolver which extensions (eg - `.js`, `.jsx`) are acceptable for resolution.
64+
- Otherwise, the file extension is resolved using the [`resolve.extensions`](/configuration/resolve/#resolveextensions) option, which tells the resolver which extensions are acceptable for resolution e.g. `.js`, `.jsx`.
6565

6666
If the path points to a folder, then the following steps are taken to find the right file with the right extension:
6767

src/content/concepts/modules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The webpack community has built _loaders_ for a wide variety of popular language
4545
- [Sass](http://sass-lang.com)
4646
- [Less](http://lesscss.org)
4747
- [Stylus](http://stylus-lang.com)
48+
- [Elm](https://elm-lang.org/)
4849

4950
And many others! Overall, webpack provides a powerful and rich API for customization that allows one to use webpack for __any stack__, while staying __non-opinionated__ about your development, testing, and production workflows.
5051

src/content/contribute/writing-a-plugin.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Plugins expose the full potential of the webpack engine to third-party developer
1313

1414
## Creating a Plugin
1515

16-
A plugin for webpack consists of
16+
A plugin for webpack consists of:
1717

18-
- A named JavaScript function.
18+
- A named JavaScript function or a JavaScript class.
1919
- Defines `apply` method in its prototype.
2020
- Specifies an [event hook](/api/compiler-hooks/) to tap into.
2121
- Manipulates webpack internal instance specific data.

src/content/guides/asset-management.md

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ __webpack.config.js__
4848
output: {
4949
- filename: 'main.js',
5050
+ filename: 'bundle.js',
51-
path: path.resolve(__dirname, 'dist')
52-
}
51+
path: path.resolve(__dirname, 'dist'),
52+
},
5353
};
5454
```
5555

@@ -71,19 +71,19 @@ __webpack.config.js__
7171
entry: './src/index.js',
7272
output: {
7373
filename: 'bundle.js',
74-
path: path.resolve(__dirname, 'dist')
74+
path: path.resolve(__dirname, 'dist'),
7575
},
7676
+ module: {
7777
+ rules: [
7878
+ {
7979
+ test: /\.css$/,
8080
+ use: [
8181
+         'style-loader',
82-
+         'css-loader'
83-
+       ]
84-
+ }
85-
+ ]
86-
+ }
82+
+         'css-loader',
83+
+       ],
84+
+ },
85+
+ ],
86+
+ },
8787
};
8888
```
8989

@@ -169,7 +169,7 @@ __webpack.config.js__
169169
entry: './src/index.js',
170170
output: {
171171
filename: 'bundle.js',
172-
path: path.resolve(__dirname, 'dist')
172+
path: path.resolve(__dirname, 'dist'),
173173
},
174174
module: {
175175
rules: [
@@ -178,16 +178,16 @@ __webpack.config.js__
178178
use: [
179179
        'style-loader',
180180
        'css-loader'
181-
      ]
181+
      ],
182182
},
183183
+ {
184184
+ test: /\.(png|svg|jpg|gif)$/,
185185
+ use: [
186-
+ 'file-loader'
187-
+ ]
188-
+ }
189-
]
190-
}
186+
+ 'file-loader',
187+
+ ],
188+
+ },
189+
],
190+
},
191191
};
192192
```
193193

@@ -277,7 +277,7 @@ __webpack.config.js__
277277
entry: './src/index.js',
278278
output: {
279279
filename: 'bundle.js',
280-
path: path.resolve(__dirname, 'dist')
280+
path: path.resolve(__dirname, 'dist'),
281281
},
282282
module: {
283283
rules: [
@@ -286,22 +286,22 @@ __webpack.config.js__
286286
use: [
287287
        'style-loader',
288288
        'css-loader'
289-
      ]
289+
      ],
290290
},
291291
{
292292
test: /\.(png|svg|jpg|gif)$/,
293293
use: [
294-
'file-loader'
295-
]
294+
'file-loader',
295+
],
296296
},
297297
+ {
298298
+ test: /\.(woff|woff2|eot|ttf|otf)$/,
299299
+ use: [
300-
+ 'file-loader'
301-
+ ]
302-
+ }
303-
]
304-
}
300+
+ 'file-loader',
301+
+ ],
302+
+ },
303+
],
304+
},
305305
};
306306
```
307307

@@ -381,7 +381,7 @@ __webpack.config.js__
381381
entry: './src/index.js',
382382
output: {
383383
filename: 'bundle.js',
384-
path: path.resolve(__dirname, 'dist')
384+
path: path.resolve(__dirname, 'dist'),
385385
},
386386
module: {
387387
rules: [
@@ -390,34 +390,34 @@ __webpack.config.js__
390390
use: [
391391
        'style-loader',
392392
        'css-loader'
393-
      ]
393+
      ],
394394
},
395395
{
396396
test: /\.(png|svg|jpg|gif)$/,
397397
use: [
398-
'file-loader'
399-
]
398+
'file-loader',
399+
],
400400
},
401401
{
402402
test: /\.(woff|woff2|eot|ttf|otf)$/,
403403
use: [
404-
'file-loader'
405-
]
404+
'file-loader',
405+
],
406406
},
407407
+ {
408408
+ test: /\.(csv|tsv)$/,
409409
+ use: [
410-
+ 'csv-loader'
411-
+ ]
410+
+ 'csv-loader',
411+
+ ],
412412
+ },
413413
+ {
414414
+ test: /\.xml$/,
415415
+ use: [
416-
+ 'xml-loader'
417-
+ ]
418-
+ }
419-
]
420-
}
416+
+ 'xml-loader',
417+
+ ],
418+
+ },
419+
],
420+
},
421421
};
422422
```
423423

@@ -541,43 +541,43 @@ __webpack.config.js__
541541
entry: './src/index.js',
542542
output: {
543543
filename: 'bundle.js',
544-
path: path.resolve(__dirname, 'dist')
544+
path: path.resolve(__dirname, 'dist'),
545545
},
546546
- module: {
547547
- rules: [
548548
- {
549549
- test: /\.css$/,
550550
- use: [
551551
-         'style-loader',
552-
-         'css-loader'
553-
-       ]
552+
-         'css-loader',
553+
-       ],
554554
- },
555555
- {
556556
- test: /\.(png|svg|jpg|gif)$/,
557557
- use: [
558-
- 'file-loader'
559-
- ]
558+
- 'file-loader',
559+
- ],
560560
- },
561561
- {
562562
- test: /\.(woff|woff2|eot|ttf|otf)$/,
563563
- use: [
564-
- 'file-loader'
565-
- ]
564+
- 'file-loader',
565+
- ],
566566
- },
567567
- {
568568
- test: /\.(csv|tsv)$/,
569569
- use: [
570-
- 'csv-loader'
571-
- ]
570+
- 'csv-loader',
571+
- ],
572572
- },
573573
- {
574574
- test: /\.xml$/,
575575
- use: [
576-
- 'xml-loader'
577-
- ]
578-
- }
579-
- ]
580-
- }
576+
- 'xml-loader',
577+
- ],
578+
- },
579+
- ],
580+
- },
581581
};
582582
```
583583

0 commit comments

Comments
 (0)