|
// dynamic values |
|
|
|
const generateShimsObject = (exports) => { |
|
let shimsObject = {}; |
|
for (let key in exports) |
|
Object.defineProperty(shimsObject, key, { get: exports[key] }); |
|
return shimsObject; |
|
}; |
|
const shims = generateShimsObject({ |
|
murmurhash: () => findByProps('v2', 'v3'), |
|
react: () => findByProps('PureComponent', 'createElement', 'Fragment'), |
|
ieee754: () => findByProps('write', 'read'), |
|
events: () => findChunkByCode(',"defaultMaxListeners"'), |
|
url: () => findByProps('resolveObject', 'Url'), |
|
punycode: () => findByProps('toASCII', 'encode'), |
|
'object-assign': () => |
|
findChunkByCode( |
|
'Object.assign cannot be called with null or undefined', |
|
), |
|
// you'll never need this anyways but here it is |
|
isarray: () => findChunkByCode('Array.isArray||'), |
|
util: () => findByProps('deprecate', 'format', 'debuglog'), |
|
'sdp-transform': () => findByProps('parseParams', 'grammar'), |
|
'query-string': () => findByProps('stringify', 'parse', 'extract'), |
|
'path-to-regexp': () => findByProps('compile', 'tokensToRegExp', 'parse'), |
|
pako: () => findByProps('gzip', 'Deflate'), |
|
process: () => findByProps('argv', 'env', 'browser'), |
|
'promise-timeout': () => findByProps('timeout', 'TimeoutError'), |
|
pseudomap: () => findChunkByCode("Constructor PseudoMap requires 'new"), |
|
platform: () => findByProps('parse', 'os', 'ua'), |
|
semver: () => findByProps('SEMVER_SPEC_VERSION'), |
|
'react/jsx-runtime': () => findByProps('jsxs', 'jsx'), |
|
'react-dom': () => findByProps('createPortal', 'useFormState'), |
|
'intl-messageformat-parser': () => findByProps('parse', 'SyntaxError'), |
|
'intl-messageformat': () => |
|
findByProps('formats', '__addLocaleData', '__parse'), |
|
'fast-safe-stringify': () => findByProps('stableStringify', 'stable'), |
|
'ip-regex': () => |
|
findChunkByCode('// 1:2:3:4:5:6:7::', '.includeBoundaries'), |
|
'is-plain-object': () => |
|
findChunkByCode( |
|
'Object.prototype.toString.call', |
|
'.constructor', |
|
'hasOwnProperty("isPrototypeOf")', |
|
), |
|
'Iru-cache': () => findChunkByCode('.rforEach='), |
|
'react-is': () => findByProps('isMemo', 'isValidElementType'), |
|
yallist: () => findChunkByCode('.removeNode=', '.tail=null'), |
|
intl: () => findByProps('NumberFormat'), |
|
history: () => findChunkByCode('.getUserConfirmation', 'PUSH'), |
|
'react-dom/client': () => findByProps('createRoot'), |
|
'@intrnl/xxhash64': () => findByProps('XXH64', 'hash'), |
|
moment: () => findByProps('isMoment'), |
|
'double-ended-queue': () => |
|
findChunkByCode('this._capacity=', 'this._front=0', 'toJSON'), |
|
'decimal.js': () => findByProps('precision', 'LN10'), |
|
'chroma-js': () => findByProps('brewer'), |
|
lodash: () => findByProps('forEachRight'), |
|
buffer: () => findByProps('INSPECT_MAX_BYTES', 'Buffer'), |
|
'decode-uri-component': () => |
|
findChunkByCode('Expected `encodedURI` to be of'), |
|
'dependency-graph': () => findByProps('DepGraph'), |
|
superagent: () => findByProps('get', 'put', 'del', 'patch', 'post'), |
|
'strict-uri-encode': () => |
|
findChunkByCode('.toString(16', 'encodeURIComponent'), |
|
'tiny-invariant': () => findChunkByCode('Invariant failed'), |
|
'simple-markdown': () => findByProps('defaultParse'), |
|
'@discordapp/twemoji': () => findByProps('base', 'parse', 'replace'), |
|
'@discord/intl': () => findByProps('createLoader', 'runtimeHashMessageKey'), |
|
'base64-js': () => findByProps('toByteArray'), |
|
humanize: () => findByProps('noConflict', 'pad', 'time'), |
|
}); |