rspack_plugin_css 0.100.0

rspack css plugin
Documentation
var oldTags = [];
var newTags = [];
var applyHandler = <%- basicFunction("options") %> {
	return {
		dispose: <%- basicFunction("") %> { },
		apply: <%- basicFunction("") %> {
			var moduleIds = [];
			newTags.forEach(<%- basicFunction("info") %> {
				info[1].sheet.disabled = false;
			});
			while (oldTags.length) {
				var oldTag = oldTags.pop();
				if (oldTag.parentNode) oldTag.parentNode.removeChild(oldTag);
			}
			while (newTags.length) {
				var info = newTags.pop();
				var chunkModuleIds = loadCssChunkData(<%- MODULE_FACTORIES %>, info[0]);
				chunkModuleIds.forEach(function(id) {
				    moduleIds.push(id)
				});
			}
			return moduleIds;
		}
	};
};
var cssTextKey = <%- basicFunction("link") %> {
	return Array.from(link.sheet.cssRules, <%- returningFunction("r.cssText", "r") %>).join();
};
<%- HMR_DOWNLOAD_UPDATE_HANDLERS %>.css = <%- basicFunction("chunkIds, removedChunks, removedModules, promises, applyHandlers, updatedModulesList") %> {
	if (typeof document === 'undefined') return;
	applyHandlers.push(applyHandler);
	chunkIds.forEach(<%- basicFunction("chunkId") %> {
		var filename = <%- GET_CHUNK_CSS_FILENAME %>(chunkId);
		var url = <%- PUBLIC_PATH %> + filename;
		var oldTag = loadStylesheet(chunkId, url);
		if (!oldTag) return;
		promises.push(
			new Promise(<%- basicFunction("resolve, reject") %> {
				var link = loadStylesheet(
					chunkId,
					url + (url.indexOf("?") < 0 ? "?" : "&") + "hmr=" + Date.now(),
					<%- basicFunction("event") %> {
						if (event.type !== "load") {
							var error = new Error();
							var errorType = event && event.type;
							var realSrc = event && event.target && event.target.src;
							error.message =
								"Loading css hot update chunk " +
								chunkId +
								" failed.\n(" +
								errorType +
								": " +
								realSrc +
								")";
							error.name = "ChunkLoadError";
							error.type = errorType;
							error.request = realSrc;
							reject(error);
						} else {
							try {
								if (cssTextKey(oldTag) == cssTextKey(link)) {
									if (link.parentNode) link.parentNode.removeChild(link);
									return resolve();
								}
							} catch (e) {}
							var factories = {};
							loadCssChunkData(factories, link, chunkId);
							Object.keys(factories).forEach(function(id) {
							    (updatedModulesList.push(id));
							});
							link.sheet.disabled = true;
							oldTags.push(oldTag);
							newTags.push([chunkId, link]);
							resolve();
						}
					},
					oldTag
				);
			})
		);
	});
};