From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- .../lib/ExportPropertyMainTemplatePlugin.js | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 node_modules/webpack/lib/ExportPropertyMainTemplatePlugin.js (limited to 'node_modules/webpack/lib/ExportPropertyMainTemplatePlugin.js') diff --git a/node_modules/webpack/lib/ExportPropertyMainTemplatePlugin.js b/node_modules/webpack/lib/ExportPropertyMainTemplatePlugin.js new file mode 100644 index 000000000..8dd80901e --- /dev/null +++ b/node_modules/webpack/lib/ExportPropertyMainTemplatePlugin.js @@ -0,0 +1,31 @@ +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +"use strict"; + +const ConcatSource = require("webpack-sources").ConcatSource; + +function accessorToObjectAccess(accessor) { + return accessor.map(a => `[${JSON.stringify(a)}]`).join(""); +} + +class ExportPropertyMainTemplatePlugin { + constructor(property) { + this.property = property; + } + + apply(compilation) { + const mainTemplate = compilation.mainTemplate; + compilation.templatesPlugin("render-with-entry", (source, chunk, hash) => { + const postfix = `${accessorToObjectAccess([].concat(this.property))}`; + return new ConcatSource(source, postfix); + }); + mainTemplate.plugin("hash", hash => { + hash.update("export property"); + hash.update(`${this.property}`); + }); + } +} + +module.exports = ExportPropertyMainTemplatePlugin; -- cgit v1.2.3