@vuepress/core 1.9.5 → 1.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,6 +20,7 @@ module.exports = class Build extends EventEmitter {
20
20
  constructor (context) {
21
21
  super()
22
22
  this.context = context
23
+ this.maxConcurrency = this.context.options.maxConcurrency
23
24
  this.outDir = this.context.outDir
24
25
  }
25
26
 
@@ -91,9 +92,18 @@ module.exports = class Build extends EventEmitter {
91
92
  // render pages
92
93
  logger.wait('Rendering static HTML...')
93
94
 
94
- const pagePaths = await Promise.all(
95
- this.context.pages.map(page => this.renderPage(page))
96
- )
95
+ // If maxConcurrency is set, instead of rendering all pages concurrently,
96
+ // build task would render pages by smaller group to prevent OOM.
97
+ if (this.maxConcurrency) logger.info(`max concurrency set: ${this.maxConcurrency}`)
98
+ const pagePaths = []
99
+ const maxConcurrency = this.maxConcurrency || 100000
100
+ for (let i = 0; i < this.context.pages.length; i += maxConcurrency) {
101
+ const segmentPaths = await Promise.all(
102
+ this.context.pages.slice(i, i + maxConcurrency)
103
+ .map(page => this.renderPage(page))
104
+ )
105
+ pagePaths.push(...segmentPaths)
106
+ }
97
107
 
98
108
  readline.clearLine(process.stdout, 0)
99
109
  readline.cursorTo(process.stdout, 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/core",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "Minimalistic doc generator with Vue component based layout system",
5
5
  "keywords": [
6
6
  "documentation",
@@ -25,12 +25,12 @@
25
25
  "dependencies": {
26
26
  "@babel/core": "^7.8.4",
27
27
  "@vue/babel-preset-app": "^4.1.2",
28
- "@vuepress/markdown": "1.9.5",
29
- "@vuepress/markdown-loader": "1.9.5",
30
- "@vuepress/plugin-last-updated": "1.9.5",
31
- "@vuepress/plugin-register-components": "1.9.5",
32
- "@vuepress/shared-utils": "1.9.5",
33
- "@vuepress/types": "1.9.5",
28
+ "@vuepress/markdown": "1.9.6",
29
+ "@vuepress/markdown-loader": "1.9.6",
30
+ "@vuepress/plugin-last-updated": "1.9.6",
31
+ "@vuepress/plugin-register-components": "1.9.6",
32
+ "@vuepress/shared-utils": "1.9.6",
33
+ "@vuepress/types": "1.9.6",
34
34
  "autoprefixer": "^9.5.1",
35
35
  "babel-loader": "^8.0.4",
36
36
  "bundle-require": "2.1.8",
@@ -77,5 +77,5 @@
77
77
  "email": "chl814@foxmail.com"
78
78
  }
79
79
  ],
80
- "gitHead": "ef6f87a5cc23903b74a86cffda325abafa7fe5e8"
80
+ "gitHead": "569921636c764f62bb942b72ee30b0610da8a57d"
81
81
  }