Skip to content

Commit c01a182

Browse files
authored
Merge pull request #1522 from docschina/sync-2eb6c6ad
docs(en): merge webpack.js.org/master into webpack.js.org/cn @ 2eb6c6a
2 parents f8e9bfa + cfd76df commit c01a182

File tree

35 files changed

+1290
-980
lines changed

35 files changed

+1290
-980
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
node-version: [16.x]
1616
runs-on: ${{ matrix.os }}
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1919

2020
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v2
21+
uses: actions/setup-node@v3
2222
with:
2323
node-version: ${{ matrix.node-version }}
2424
cache: yarn
@@ -31,7 +31,7 @@ jobs:
3131
- run: yarn lint:links
3232

3333
- name: Deploy
34-
uses: JamesIves/github-pages-deploy-action@4.1.8
34+
uses: JamesIves/github-pages-deploy-action@v4.2.5
3535
with:
3636
token: ${{ secrets.GITHUB_TOKEN }}
3737
branch: gh-pages

.github/workflows/testing.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
node-version: [16.x]
1313
runs-on: ${{ matrix.os }}
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1616

1717
- name: Use Node.js ${{ matrix.node-version }}
18-
uses: actions/setup-node@v2
18+
uses: actions/setup-node@v3
1919
with:
2020
node-version: ${{ matrix.node-version }}
2121
cache: yarn
@@ -31,7 +31,7 @@ jobs:
3131
os: [ubuntu-latest]
3232
runs-on: ${{ matrix.os }}
3333
steps:
34-
- uses: actions/checkout@v2
34+
- uses: actions/checkout@v3
3535

3636
- name: Vale
3737
uses: errata-ai/vale-action@v1.4.2
@@ -48,10 +48,10 @@ jobs:
4848
node-version: [16.x]
4949
runs-on: ${{ matrix.os }}
5050
steps:
51-
- uses: actions/checkout@v2
51+
- uses: actions/checkout@v3
5252

5353
- name: Use Node.js ${{ matrix.node-version }}
54-
uses: actions/setup-node@v2
54+
uses: actions/setup-node@v3
5555
with:
5656
node-version: ${{ matrix.node-version }}
5757
cache: yarn
@@ -72,10 +72,10 @@ jobs:
7272
node-version: [16.x]
7373
runs-on: ${{ matrix.os }}
7474
steps:
75-
- uses: actions/checkout@v2
75+
- uses: actions/checkout@v3
7676

7777
- name: Use Node.js ${{ matrix.node-version }}
78-
uses: actions/setup-node@v2
78+
uses: actions/setup-node@v3
7979
with:
8080
node-version: ${{ matrix.node-version }}
8181
cache: yarn

package.json

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -73,53 +73,54 @@
7373
]
7474
},
7575
"devDependencies": {
76-
"@babel/core": "^7.17.0",
76+
"@babel/core": "^7.17.8",
7777
"@babel/eslint-parser": "^7.17.0",
7878
"@babel/plugin-proposal-class-properties": "^7.16.7",
7979
"@babel/preset-env": "^7.16.11",
8080
"@babel/preset-react": "^7.16.7",
8181
"@mdx-js/loader": "^2.0.0-next.9",
8282
"@octokit/auth-action": "^1.3.3",
8383
"@octokit/rest": "^18.12.0",
84+
"@parcel/css": "^1.7.4",
8485
"@pmmmwh/react-refresh-webpack-plugin": "next",
8586
"@svgr/webpack": "^6.2.1",
86-
"autoprefixer": "^10.4.2",
87-
"babel-loader": "^8.2.3",
87+
"autoprefixer": "^10.4.4",
88+
"babel-loader": "^8.2.4",
8889
"copy-webpack-plugin": "^10.2.4",
89-
"css-loader": "^6.6.0",
90+
"css-loader": "^6.7.1",
9091
"css-minimizer-webpack-plugin": "^3.4.1",
91-
"cypress": "^9.4.1",
92-
"directory-tree": "^3.1.0",
92+
"cypress": "^9.5.3",
93+
"directory-tree": "^3.2.2",
9394
"directory-tree-webpack-plugin": "^1.0.3",
9495
"duplexer": "^0.1.1",
95-
"eslint": "^8.8.0",
96-
"eslint-config-prettier": "^8.3.0",
96+
"eslint": "^8.12.0",
97+
"eslint-config-prettier": "^8.5.0",
9798
"eslint-plugin-cypress": "^2.12.1",
98-
"eslint-plugin-mdx": "^1.16.0",
99-
"eslint-plugin-react": "^7.28.0",
100-
"eslint-plugin-react-hooks": "^4.3.0",
99+
"eslint-plugin-mdx": "^1.17.0",
100+
"eslint-plugin-react": "^7.29.4",
101+
"eslint-plugin-react-hooks": "^4.4.0",
101102
"front-matter": "^4.0.2",
102-
"github-slugger": "^1.3.0",
103+
"github-slugger": "^1.4.0",
103104
"html-loader": "^2.1.2",
104105
"html-webpack-plugin": "^5.5.0",
105106
"http-server": "^14.1.0",
106107
"husky": "^7.0.4",
107108
"hyperlink": "^5.0.4",
108-
"jest": "^27.5.0",
109-
"lint-staged": "^12.3.3",
109+
"jest": "^27.5.1",
110+
"lint-staged": "^12.3.7",
110111
"lodash": "^4.17.21",
111112
"markdownlint": "^0.25.1",
112-
"markdownlint-cli": "^0.31.0",
113-
"mdast-util-to-string": "^1.1.0",
114-
"mini-css-extract-plugin": "^2.5.3",
113+
"markdownlint-cli": "^0.31.1",
114+
"mdast-util-to-string": "^3.1.0",
115+
"mini-css-extract-plugin": "^2.6.0",
115116
"mkdirp": "^1.0.4",
116117
"modularscale-sass": "^3.0.3",
117-
"node-fetch": "^3.2.0",
118+
"node-fetch": "^3.2.3",
118119
"npm-run-all": "^4.1.1",
119-
"postcss": "^8.4.6",
120+
"postcss": "^8.4.12",
120121
"postcss-loader": "^6.2.1",
121-
"prettier": "^2.5.1",
122-
"react-refresh": "^0.11.0",
122+
"prettier": "^2.6.1",
123+
"react-refresh": "^0.12.0",
123124
"redirect-webpack-plugin": "^1.0.0",
124125
"remark": "^14.0.2",
125126
"remark-autolink-headings": "7.0.1",
@@ -129,42 +130,41 @@
129130
"remark-gfm": "^1.0.0",
130131
"remark-html": "^15.0.1",
131132
"remark-refractor": "montogeek/remark-refractor",
132-
"remark-slug": "^7.0.1",
133133
"rimraf": "^3.0.2",
134-
"sass": "^1.49.7",
135-
"sass-loader": "^12.4.0",
134+
"sass": "^1.49.10",
135+
"sass-loader": "^12.6.0",
136136
"sirv-cli": "^2.0.2",
137137
"sitemap-static": "^0.4.2",
138138
"start-server-and-test": "^1.14.0",
139139
"static-site-generator-webpack-plugin": "^3.4.1",
140140
"style-loader": "^3.3.1",
141-
"tailwindcss": "^3.0.18",
141+
"tailwindcss": "^3.0.23",
142142
"tap-spot": "^1.1.1",
143143
"textlint": "^11.8.2",
144144
"textlint-rule-heading": "^1.0.10",
145145
"unist-util-visit": "^4.1.0",
146-
"webpack": "^5.68.0",
146+
"webpack": "^5.71.0",
147147
"webpack-bundle-analyzer": "^4.5.0",
148148
"webpack-cli": "^4.9.2",
149149
"webpack-dev-server": "^4.7.4",
150150
"webpack-merge": "^5.8.0",
151-
"workbox-webpack-plugin": "^6.4.2"
151+
"workbox-webpack-plugin": "^6.5.2"
152152
},
153153
"dependencies": {
154154
"@docsearch/react": "^3.0.0-alpha.50",
155155
"path-browserify": "^1.0.1",
156156
"prop-types": "^15.8.1",
157157
"react": "^17.0.2",
158158
"react-dom": "^17.0.2",
159-
"react-helmet-async": "^1.2.2",
160-
"react-router-dom": "^6.2.1",
161-
"react-spring": "^9.4.2",
159+
"react-helmet-async": "^1.2.3",
160+
"react-router-dom": "^6.3.0",
161+
"react-spring": "^9.4.4",
162162
"react-tiny-popover": "5",
163163
"react-use": "^17.3.2",
164164
"react-visibility-sensor": "^5.0.2",
165165
"webpack-pwa-manifest": "^4.3.0",
166166
"webpack.vote": "https://github.com/webpack/voting-app.git",
167-
"workbox-window": "^6.4.2"
167+
"workbox-window": "^6.5.2"
168168
},
169169
"resolutions": {
170170
"sitemap-static/minimist": "1.2.5",

src/components/Markdown/Markdown.scss

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@use "sass:color";
1+
@use 'sass:color';
22
@import 'vars';
33
@import 'functions';
44
@import 'prism-theme';
@@ -41,15 +41,16 @@ $topHeightMobileWithBanner: $bannerHeight + $topHeightMobile;
4141
h4,
4242
h5,
4343
h6 {
44-
&:before {
45-
content: '';
44+
> span[id] {
45+
position: absolute;
46+
width: 0;
4647
display: block;
4748
visibility: hidden;
4849
pointer-events: none;
49-
height: $topHeightMobile;
50+
padding-top: $topHeightMobile;
5051
margin-top: -#{$topHeightMobile};
5152
@include break {
52-
height: $topHeightDesktop;
53+
padding-top: $topHeightDesktop;
5354
margin-top: -#{$topHeightDesktop};
5455
}
5556
}

src/components/Page/Page.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ export default function Page(props) {
9797
<Markdown>
9898
<h1>{title}</h1>
9999

100+
{rest.thirdParty ? (
101+
<div className="italic my-[20px]">
102+
<strong className="font-bold">Disclaimer:</strong> {title} is a
103+
third-party package maintained by community members, it potentially
104+
does not have the same support, security policy or license as
105+
webpack, and it is not maintained by webpack.
106+
</div>
107+
) : null}
108+
100109
{contentRender}
101110

102111
{loadRelated && (

src/components/Site/Site.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function Site(props) {
269269
),
270270
},
271271
{ content: '参与贡献', url: '/contribute/' },
272-
{ content: '投票', url: 'https://v4.webpack.docschina.org/vote/' },
272+
{ content: '投票', url: 'https://webpack.js.org/vote/' },
273273
{ content: '博客', url: '/blog/' },
274274
{ content: '印记中文', url: 'https://docschina.org' },
275275
]}

src/components/Support/Support.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function formatMoney(number) {
8585
let str = Math.round(number) + '';
8686

8787
if (str.length > 3) {
88-
str = str.substr(0, str.length - 3) + ',' + str.substr(-3);
88+
str = str.slice(0, -3) + ',' + str.slice(-3);
8989
}
9090
return str;
9191
}

src/content/api/cli.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ npx webpack init ./my-app --force --template=default
101101

102102
`boolean`
103103

104-
生成项目时不启用选项模式。当为 `true` 时,所有命令行选项使用默认值
104+
不输入配置项就生成一个项目。该配置启用时所有命令行配置项将使用默认值
105105

106106
T> 点击 [这里](https://github.com/webpack/webpack-cli/blob/master/packages/generators/INIT.md) 获取 `webpack init` 命令的完整文档。
107107

@@ -583,7 +583,7 @@ T> 请查阅 [environment 变量指南](/guides/environment-variables/)了解更
583583

584584
| 变量名 | 描述 |
585585
| --------------- | --------------------------------------------- |
586-
| `WEBPACK_SERVE` | 如果使用了 `serve\|s`,则为 `true`|
586+
| `WEBPACK_SERVE` | 如果使用了 `serve\|server\|s`,则为 `true`|
587587
| `WEBPACK_BUILD` | 如果使用了 `build\|bundle\|b`,则为 `true`|
588588
| `WEBPACK_WATCH` | 如果使用了 `--watch\|watch\|w`,则为 `true`|
589589

src/content/api/compilation-object.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,7 @@ Compilation 对象有很多可用的方法和钩子。在此页面,我们将
229229
- `block` - `Chunk` 的块连接。
230230
- `chunk` - 从依赖中删除的块。
231231

232-
### sortItemsWithModuleIds $#sortitemswithmoduleids$
233-
234-
`function`
235-
236-
### sortItemsWithChunkIds $#sortitemswithchunkids$
232+
### sortItemsWithChunkIds $#sortitemswithmoduleids$
237233

238234
`function`
239235

src/content/api/module-variables.mdx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,41 @@ console.log(import.meta.webpack); // output `5` for webpack 5
109109
110110
webpack 特定。[`module.hot`](#modulehot-webpack-specific) 的一个别名,[strict ESM](/guides/ecma-script-modules/#flagging-modules-as-esm) 中可以使用 `import.meta.webpackHot` 但是不能使用 `module.hot`
111111
112-
## \_\_filename (NodeJS) $#__filename-nodejs$
112+
## import.meta.webpackContext
113+
114+
返回与 `require.context` 一样的值,但是仅用于 `javascript/auto``javascript/esm`
115+
116+
- 类型:
117+
118+
```ts
119+
(
120+
request: string,
121+
options?: {
122+
recursive?: boolean;
123+
regExp?: RegExp;
124+
include?: RegExp;
125+
exclude?: RegExp;
126+
preload?: boolean | number;
127+
prefetch?: boolean | number;
128+
chunkName?: string;
129+
exports?: string | string[][];
130+
mode?: 'sync' | 'eager' | 'weak' | 'lazy' | 'lazy-once';
131+
}
132+
) => webpack.Context;
133+
```
134+
135+
- 可用版本:5.70.0+
136+
- 示例:
137+
```js
138+
const contextRequire = import.meta.webpackContext('.', {
139+
recursive: false,
140+
regExp: /two/,
141+
mode: 'weak',
142+
exclude: /three/,
143+
});
144+
```
145+
146+
## \_\_filename (NodeJS)
113147
114148
取决于 `node.__filename` 配置选项:
115149

0 commit comments

Comments
 (0)