From 8c11da5219819bd8e9541905b5ab3e739435c2d5 Mon Sep 17 00:00:00 2001 From: Mihail Bodrov Date: Tue, 13 Mar 2018 03:17:49 +0300 Subject: [PATCH 1/3] Save identifier module after first getting --- lib/ContextModule.js | 5 +++++ lib/MultiModule.js | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 0c2c5b2d40f..1fcdad3e00c 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -44,6 +44,8 @@ class ContextModule extends Module { if (typeof options.mode !== "string") throw new Error("options.mode is a required option"); + + this._identifier = null; } prettyRegExp(regexString) { @@ -65,6 +67,7 @@ class ContextModule extends Module { } identifier() { + if (this._identifier) return this._identifier; let identifier = this.context; if (this.options.resourceQuery) identifier += ` ${this.options.resourceQuery}`; @@ -78,6 +81,8 @@ class ContextModule extends Module { identifier += " strict namespace object"; else if (this.options.namespaceObject) identifier += " namespace object"; + this._identifier = identifier; + return identifier; } diff --git a/lib/MultiModule.js b/lib/MultiModule.js index 19aa25cb6ec..115e8edf9ca 100644 --- a/lib/MultiModule.js +++ b/lib/MultiModule.js @@ -15,10 +15,13 @@ class MultiModule extends Module { // Info from Factory this.dependencies = dependencies; this.name = name; + this._identifier = `multi ${this.dependencies + .map(d => d.request) + .join(" ")}`; } identifier() { - return `multi ${this.dependencies.map(d => d.request).join(" ")}`; + return this._identifier; } readableIdentifier(requestShortener) { From ee22d498fe6d415b2ed33249dead90020ee55cfd Mon Sep 17 00:00:00 2001 From: Mihail Bodrov Date: Sat, 24 Mar 2018 19:02:30 +0100 Subject: [PATCH 2/3] Compute identifier in context module in constructor --- lib/ContextModule.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/ContextModule.js b/lib/ContextModule.js index 1fcdad3e00c..c34a6d88454 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -45,7 +45,7 @@ class ContextModule extends Module { if (typeof options.mode !== "string") throw new Error("options.mode is a required option"); - this._identifier = null; + this._identifier = this._createIdentifier(); } prettyRegExp(regexString) { @@ -66,8 +66,7 @@ class ContextModule extends Module { .join("!"); } - identifier() { - if (this._identifier) return this._identifier; + _createIdentifier() { let identifier = this.context; if (this.options.resourceQuery) identifier += ` ${this.options.resourceQuery}`; @@ -86,6 +85,10 @@ class ContextModule extends Module { return identifier; } + identifier() { + return this._identifier; + } + readableIdentifier(requestShortener) { let identifier = requestShortener.shorten(this.context); if (this.options.resourceQuery) From 9012ab9ace5086fc7c56f5e3be4690d78e398845 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Mon, 26 Mar 2018 15:46:05 +0200 Subject: [PATCH 3/3] remove duplicate assignment --- lib/ContextModule.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/ContextModule.js b/lib/ContextModule.js index c34a6d88454..72c2e16ad36 100644 --- a/lib/ContextModule.js +++ b/lib/ContextModule.js @@ -80,8 +80,6 @@ class ContextModule extends Module { identifier += " strict namespace object"; else if (this.options.namespaceObject) identifier += " namespace object"; - this._identifier = identifier; - return identifier; }