From 1fb08a64220af5feb17995b8d46be493d8126fb6 Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 26 Jul 2024 17:42:07 -0400 Subject: [PATCH] fix: terser to ignore every exported tinymidipcm symbols --- webpack.config.js | 258 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 249 insertions(+), 9 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index ca7e3f21..d9b054db 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -26,14 +26,14 @@ const htmlPlugins = pages.map(name => { const config = { entry: { index: './src/js/game.ts', - playground: './src/js/playground.js', - viewer: './src/js/viewer.ts', - mesanim: './src/js/mesanim.ts', - items: './src/js/items.ts', - sounds: './src/js/sounds.ts', - ['interface-editor']: './src/js/interface-editor.ts', - JagEd: './src/js/JagEd.ts', - mapview: './src/js/mapview.ts' + // playground: './src/js/playground.js', + // viewer: './src/js/viewer.ts', + // mesanim: './src/js/mesanim.ts', + // items: './src/js/items.ts', + // sounds: './src/js/sounds.ts', + // ['interface-editor']: './src/js/interface-editor.ts', + // JagEd: './src/js/JagEd.ts', + // mapview: './src/js/mapview.ts' }, plugins: [ @@ -149,7 +149,247 @@ module.exports = () => { '__getU32', '__pin', '__new', - '__unpin' + '__unpin', + 'run', + 'UTF8ArrayToString', + 'UTF8ToString', + 'stringToUTF8Array', + 'stringToUTF8', + 'lengthBytesUTF8', + 'addOnPreRun', + 'addOnInit', + 'addOnPreMain', + 'addOnExit', + 'addOnPostRun', + 'addRunDependency', + 'removeRunDependency', + 'FS_createFolder', + 'FS_createPath', + 'FS_createDataFile', + 'FS_createPreloadedFile', + 'FS_createLazyFile', + 'FS_createLink', + 'FS_createDevice', + 'FS_unlink', + 'getLEB', + 'getFunctionTables', + 'alignFunctionTables', + 'registerFunctions', + 'prettyPrint', + 'getCompilerSetting', + 'print', + 'printErr', + 'callMain', + 'abort', + 'keepRuntimeAlive', + 'wasmMemory', + 'stackAlloc', + 'stackSave', + 'stackRestore', + 'getTempRet0', + 'setTempRet0', + 'writeStackCookie', + 'checkStackCookie', + 'ptrToString', + 'zeroMemory', + 'stringToNewUTF8', + 'exitJS', + 'getHeapMax', + 'emscripten_realloc_buffer', + 'ENV', + 'ERRNO_CODES', + 'ERRNO_MESSAGES', + 'setErrNo', + 'inetPton4', + 'inetNtop4', + 'inetPton6', + 'inetNtop6', + 'readSockaddr', + 'writeSockaddr', + 'DNS', + 'getHostByName', + 'Protocols', + 'Sockets', + 'getRandomDevice', + 'warnOnce', + 'traverseStack', + 'UNWIND_CACHE', + 'convertPCtoSourceLocation', + 'readAsmConstArgsArray', + 'readAsmConstArgs', + 'mainThreadEM_ASM', + 'jstoi_q', + 'jstoi_s', + 'getExecutableName', + 'listenOnce', + 'autoResumeAudioContext', + 'dynCallLegacy', + 'getDynCaller', + 'dynCall', + 'handleException', + 'runtimeKeepalivePush', + 'runtimeKeepalivePop', + 'callUserCallback', + 'maybeExit', + 'safeSetTimeout', + 'asmjsMangle', + 'asyncLoad', + 'alignMemory', + 'mmapAlloc', + 'writeI53ToI64', + 'writeI53ToI64Clamped', + 'writeI53ToI64Signaling', + 'writeI53ToU64Clamped', + 'writeI53ToU64Signaling', + 'readI53FromI64', + 'readI53FromU64', + 'convertI32PairToI53', + 'convertI32PairToI53Checked', + 'convertU32PairToI53', + 'getCFunc', + 'ccall', + 'cwrap', + 'uleb128Encode', + 'sigToWasmTypes', + 'generateFuncType', + 'convertJsFunctionToWasm', + 'freeTableIndexes', + 'functionsInTableMap', + 'getEmptyTableSlot', + 'updateTableMap', + 'addFunction', + 'removeFunction', + 'reallyNegative', + 'unSign', + 'strLen', + 'reSign', + 'formatString', + 'PATH', + 'PATH_FS', + 'intArrayFromString', + 'intArrayToString', + 'AsciiToString', + 'stringToAscii', + 'UTF16Decoder', + 'UTF16ToString', + 'stringToUTF16', + 'lengthBytesUTF16', + 'UTF32ToString', + 'stringToUTF32', + 'lengthBytesUTF32', + 'allocateUTF8', + 'allocateUTF8OnStack', + 'writeStringToMemory', + 'writeArrayToMemory', + 'writeAsciiToMemory', + 'SYSCALLS', + 'getSocketFromFD', + 'getSocketAddress', + 'JSEvents', + 'registerKeyEventCallback', + 'specialHTMLTargets', + 'maybeCStringToJsString', + 'findEventTarget', + 'findCanvasEventTarget', + 'getBoundingClientRect', + 'fillMouseEventData', + 'registerMouseEventCallback', + 'registerWheelEventCallback', + 'registerUiEventCallback', + 'registerFocusEventCallback', + 'fillDeviceOrientationEventData', + 'registerDeviceOrientationEventCallback', + 'fillDeviceMotionEventData', + 'registerDeviceMotionEventCallback', + 'screenOrientation', + 'fillOrientationChangeEventData', + 'registerOrientationChangeEventCallback', + 'fillFullscreenChangeEventData', + 'registerFullscreenChangeEventCallback', + 'JSEvents_requestFullscreen', + 'JSEvents_resizeCanvasForFullscreen', + 'registerRestoreOldStyle', + 'hideEverythingExceptGivenElement', + 'restoreHiddenElements', + 'setLetterbox', + 'currentFullscreenStrategy', + 'restoreOldWindowedStyle', + 'softFullscreenResizeWebGLRenderTarget', + 'doRequestFullscreen', + 'fillPointerlockChangeEventData', + 'registerPointerlockChangeEventCallback', + 'registerPointerlockErrorEventCallback', + 'requestPointerLock', + 'fillVisibilityChangeEventData', + 'registerVisibilityChangeEventCallback', + 'registerTouchEventCallback', + 'fillGamepadEventData', + 'registerGamepadEventCallback', + 'registerBeforeUnloadEventCallback', + 'fillBatteryEventData', + 'battery', + 'registerBatteryEventCallback', + 'setCanvasElementSize', + 'getCanvasElementSize', + 'demangle', + 'demangleAll', + 'jsStackTrace', + 'stackTrace', + 'ExitStatus', + 'getEnvStrings', + 'checkWasiClock', + 'flush_NO_FILESYSTEM', + 'dlopenMissingError', + 'createDyncallWrapper', + 'setImmediateWrapped', + 'clearImmediateWrapped', + 'polyfillSetImmediate', + 'uncaughtExceptionCount', + 'exceptionLast', + 'exceptionCaught', + 'ExceptionInfo', + 'exception_addRef', + 'exception_decRef', + 'Browser', + 'setMainLoop', + 'wget', + 'FS', + 'MEMFS', + 'TTY', + 'PIPEFS', + 'SOCKFS', + '_setNetworkCallback', + 'tempFixedLengthArray', + 'miniTempWebGLFloatBuffers', + 'heapObjectForWebGLType', + 'heapAccessShiftForWebGLHeap', + 'GL', + 'emscriptenWebGLGet', + 'computeUnpackAlignedImageSize', + 'emscriptenWebGLGetTexPixelData', + 'emscriptenWebGLGetUniform', + 'webglGetUniformLocation', + 'webglPrepareUniformLocationsBeforeFirstUse', + 'webglGetLeftBracePos', + 'emscriptenWebGLGetVertexAttrib', + 'writeGLArray', + 'AL', + 'SDL_unicode', + 'SDL_ttfContext', + 'SDL_audio', + 'SDL', + 'SDL_gfx', + 'GLUT', + 'EGL', + 'GLFW_Window', + 'GLFW', + 'GLEW', + 'IDBStore', + 'runAndAbortIfError', + 'ALLOC_NORMAL', + 'ALLOC_STACK', + 'allocate', + 'grow' ] } },