Commit bfdb161b authored by Mike Greiling's avatar Mike Greiling

Merge branch 'ps-remove-extends-incremental-webpack-compiler' into 'master'

Remove "extends" in `incremental_webpack_compiler` and add "_" to privates

See merge request gitlab-org/gitlab!52859
parents b1a936ba 105a247c
...@@ -21,9 +21,9 @@ class NoopCompiler { ...@@ -21,9 +21,9 @@ class NoopCompiler {
setupMiddleware() {} setupMiddleware() {}
} }
class IncrementalWebpackCompiler extends NoopCompiler { class IncrementalWebpackCompiler {
constructor(historyFilePath) { constructor(historyFilePath) {
super(); this.enabled = true;
this.history = {}; this.history = {};
this.compiledEntryPoints = new Set([ this.compiledEntryPoints = new Set([
// Login page // Login page
...@@ -32,8 +32,7 @@ class IncrementalWebpackCompiler extends NoopCompiler { ...@@ -32,8 +32,7 @@ class IncrementalWebpackCompiler extends NoopCompiler {
'pages.root', 'pages.root',
]); ]);
this.historyFilePath = historyFilePath; this.historyFilePath = historyFilePath;
this.loadFromHistory(); this._loadFromHistory();
this.enabled = true;
} }
filterEntryPoints(entrypoints) { filterEntryPoints(entrypoints) {
...@@ -65,7 +64,7 @@ class IncrementalWebpackCompiler extends NoopCompiler { ...@@ -65,7 +64,7 @@ class IncrementalWebpackCompiler extends NoopCompiler {
if (fileName.startsWith('pages.') && fileName.endsWith('.chunk.js')) { if (fileName.startsWith('pages.') && fileName.endsWith('.chunk.js')) {
const chunk = fileName.replace(/\.chunk\.js$/, ''); const chunk = fileName.replace(/\.chunk\.js$/, '');
this.addToHistory(chunk); this._addToHistory(chunk);
if (!this.compiledEntryPoints.has(chunk)) { if (!this.compiledEntryPoints.has(chunk)) {
log(`First time we are seeing ${chunk}. Adding to compilation.`); log(`First time we are seeing ${chunk}. Adding to compilation.`);
...@@ -88,7 +87,7 @@ class IncrementalWebpackCompiler extends NoopCompiler { ...@@ -88,7 +87,7 @@ class IncrementalWebpackCompiler extends NoopCompiler {
// private methods // private methods
addToHistory(chunk) { _addToHistory(chunk) {
if (!this.history[chunk]) { if (!this.history[chunk]) {
this.history[chunk] = { lastVisit: null, count: 0 }; this.history[chunk] = { lastVisit: null, count: 0 };
} }
...@@ -102,7 +101,7 @@ class IncrementalWebpackCompiler extends NoopCompiler { ...@@ -102,7 +101,7 @@ class IncrementalWebpackCompiler extends NoopCompiler {
} }
} }
loadFromHistory() { _loadFromHistory() {
try { try {
this.history = JSON.parse(fs.readFileSync(this.historyFilePath, 'utf8')); this.history = JSON.parse(fs.readFileSync(this.historyFilePath, 'utf8'));
const entryPoints = Object.keys(this.history); const entryPoints = Object.keys(this.history);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment