Sha256: ddbc5f7e9322e5c406c06918fe6b17866b6b79ab72afebcddabdca222e361770

Contents?: true

Size: 924 Bytes

Versions: 62

Compression:

Stored size: 924 Bytes

Contents

/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
var ConcatSource = require("webpack-core/lib/ConcatSource");

function JsonpExportMainTemplatePlugin(name) {
	this.name = name;
}
module.exports = JsonpExportMainTemplatePlugin;
JsonpExportMainTemplatePlugin.prototype.apply = function(compilation) {
	var mainTemplate = compilation.mainTemplate;
	compilation.templatesPlugin("render-with-entry", function(source, chunk, hash) {
		var name = mainTemplate.applyPluginsWaterfall("asset-path", this.name || "", {
			hash: hash,
			chunk: chunk
		});
		return new ConcatSource(name + "(", source, ");");
	}.bind(this));
	mainTemplate.plugin("global-hash-paths", function(paths) {
		if (this.name) paths.push(this.name);
		return paths;
	}.bind(this));
	mainTemplate.plugin("hash", function(hash) {
		hash.update("jsonp export");
		hash.update(this.name + "");
	}.bind(this));
};

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
smock-0.1.268 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.267 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.266 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.265 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.264 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.263 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.262 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.261 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.260 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.259 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.258 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.256 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.255 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.254 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.253 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.252 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.251 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.250 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.249 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js
smock-0.1.247 node_modules/webpack/lib/JsonpExportMainTemplatePlugin.js