mapbox / mapbox-gl-rtl-text

Add right-to-left text support to Mapbox GL JS
Other
53 stars 20 forks source link

Packaging support for UMD as well as CommonJS. #14

Closed ChrisLoer closed 5 years ago

ChrisLoer commented 5 years ago

As part of rebuilding, I upgraded the emscripten version to 1.38.12. That makes for a large diff, so I split that out into a separate commit.

@w8r, does this look like it will address your use case? I've tested that it still works with our existing test-suite and as a plugin in GL JS. Once we merge this I'll go ahead and publish this as version 0.2.1 of the package.

cc @ryanhamley

w8r commented 5 years ago

Thanks a lot, @ChrisLoer! I added a comment where it still fails if you execute it in the browser

w8r commented 5 years ago

👍 it works, thanks a lot! It exposes a lot of things, as it is forced by Emscripten at the beginning of the file, but it only happens in Node.js or similar environment, not if included in the browser.

const rtl = require('./index.js');
console.log(Object.keys(rtl));
/*
[ 'TOTAL_MEMORY',
  'TOTAL_STACK',
  'preRun',
  'postRun',
  'print',
  'printErr',
  'arguments',
  'thisProgram',
  'quit',
  'read',
  'readBinary',
  'inspect',
  'reallocBuffer',
  'buffer',
  'HEAP8',
  'HEAP16',
  'HEAP32',
  'HEAPU8',
  'HEAPU16',
  'HEAPU32',
  'HEAPF32',
  'HEAPF64',
  'preloadedImages',
  'preloadedAudios',
  'asmGlobalArg',
  'asmLibraryArg',
  '___cxa_can_catch',
  '___cxa_is_pointer_type',
  '___emscripten_environ_constructor',
  '__get_daylight',
  '__get_environ',
  '__get_timezone',
  '__get_tzname',
  '_bidi_getLine',
  '_bidi_getParagraphEndIndex',
  '_bidi_getVisualRun',
  '_bidi_processText',
  '_bidi_setLine',
  '_bidi_writeReverse',
  '_emscripten_replace_memory',
  '_free',
  '_malloc',
  '_memalign',
  '_memcpy',
  '_memset',
  '_sbrk',
  '_ushape_arabic',
  'establishStackSpace',
  'getTempRet0',
  'runPostSets',
  'setTempRet0',
  'setThrew',
  'stackAlloc',
  'stackRestore',
  'stackSave',
  'dynCall_iii',
  'dynCall_iiii',
  'dynCall_vi',
  'dynCall_viiii',
  'dynCall_viiiii',
  'dynCall_viiiiii',
  'asm',
  'ccall',
  'UTF16ToString',
  'stringToUTF16',
  'run',
  'abort',
  'noExitRuntime',
  'calledRun',
  'applyArabicShaping',
  'processBidirectionalText',
  'processStyledBidirectionalText' ];
*/
ChrisLoer commented 5 years ago

It exposes a lot of things

Yeah, that's kind of unfortunate, but consistent with how it behaved before, I think I'll leave that in place for now.

w8r commented 5 years ago

Thanks once again, it works great for us!