mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-14 10:41:52 +00:00
Remove unused webpack files
This commit is contained in:
parent
031a7c05d5
commit
903b196e1e
@ -1,21 +0,0 @@
|
|||||||
/*jslint node:true */
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
const startComment = "typehints:start";
|
|
||||||
const endComment = "typehints:end";
|
|
||||||
const regexPattern = new RegExp(
|
|
||||||
"[\\t ]*\\/\\* ?" + startComment + " ?\\*\\/[\\s\\S]*?\\/\\* ?" + endComment + " ?\\*\\/[\\t ]*\\n?",
|
|
||||||
"g"
|
|
||||||
);
|
|
||||||
|
|
||||||
function StripBlockLoader(content) {
|
|
||||||
if (content.indexOf(startComment) >= 0) {
|
|
||||||
content = content.replace(regexPattern, "");
|
|
||||||
}
|
|
||||||
if (this.cacheable) {
|
|
||||||
this.cacheable(true);
|
|
||||||
}
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = StripBlockLoader;
|
|
||||||
39
gulp/mod.js
39
gulp/mod.js
@ -1,39 +0,0 @@
|
|||||||
const oneExport = exp => {
|
|
||||||
return `${exp}=v`; // No checks needed
|
|
||||||
};
|
|
||||||
|
|
||||||
const twoExports = (exp1, exp2) => {
|
|
||||||
return `n=="${exp1}"?${exp1}=v:${exp2}=v`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const multiExports = exps => {
|
|
||||||
exps = exps.map(exp => `case "${exp}":${exp}=v;break;`);
|
|
||||||
|
|
||||||
return `switch(n){${exps.toString().replaceAll(";,", ";")} }`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const defineFnBody = source => {
|
|
||||||
const regex = /export (?:let|class) (?<name>\w+)/g;
|
|
||||||
let names = [...source.matchAll(regex)].map(n => n.groups.name);
|
|
||||||
switch (names.length) {
|
|
||||||
case 0:
|
|
||||||
return false;
|
|
||||||
case 1:
|
|
||||||
return oneExport(names[0]);
|
|
||||||
case 2:
|
|
||||||
return twoExports(names[0], names[1]);
|
|
||||||
default:
|
|
||||||
return multiExports(names);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {string} source
|
|
||||||
* @param {*} map
|
|
||||||
* @returns
|
|
||||||
*/
|
|
||||||
module.exports = function (source, map) {
|
|
||||||
const body = defineFnBody(source);
|
|
||||||
if (!body) return source;
|
|
||||||
return source + `\nexport const __$S__=(n,v)=>{${body}}`;
|
|
||||||
};
|
|
||||||
Loading…
Reference in New Issue
Block a user