[TIMOB-24796] iOS: Hybrid CommonJS and Native modules don't handle multiple js files #9131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
JIRA: https://jira.appcelerator.org/browse/TIMOB-24796
Description:
Fixes require resolution for js files living in the assets folder of a "native" module. Specifically, simply avoid mangling the filenames.
We hand titanium_prep a list of JS files to encrypt into a class, that uses a map of file paths to indices that then look up a block of bytes. Our require behavior for encrypted assets was changing '.' to '_' in the file paths first. This is because our old python-based module build for iOS would mangle filenames in the same way for js files in the assets folder. (In fact we still do mangle filenames like this in normal apps' JS files on device when encrypting, and we convert to the mangled name in TiUtils.m)
This fix looks for the non-mangled name first (because that's what the Node-js based module builds produce, and because name mangling doesn't seem to gain us anything); then falls back to trying the mangled name next.