2021-02-14 18:30:46 +00:00
|
|
|
const basicIncludes = (bundleCode, code, display = (code[0].toUpperCase() + code.substring(1))) => {
|
2021-02-17 18:10:41 +00:00
|
|
|
// if (bundleCode.includes(code)) return display;
|
2021-02-17 18:12:09 +00:00
|
|
|
if (bundleCode.includes(code)) return display.toLowerCase(); // We make the actual tag all lowercase for now due to bug in GM v7.0.0
|
2021-02-14 18:30:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default (bundleCode) => { // Scans final bundle JS to try and auto-detect things, then adding tags
|
|
|
|
const tags = [
|
|
|
|
basicIncludes(bundleCode, 'react'),
|
|
|
|
basicIncludes(bundleCode, 'document', 'DOM'),
|
|
|
|
].filter((x) => x !== undefined);
|
|
|
|
|
|
|
|
return tags;
|
|
|
|
};
|