Prevent file system paths from being included in mml3 extension. #993
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.
Webpack will replaced
import.meta.urlby a literal string for the path of the file on the system where it is being run. That means files that includeimport.meta.urlwill have references to the host file system where webpack is run (in our case, the travis-ci servers). Thebeta.3version worked around this issue in thets/components/loader.tsfile by replacing#root/root.jswith one that uses/rather thanimport.meta.url; butts/input/mathml/mml3also includes references toimport.meta.url, and so themml3extension was still incorrectly including the full path name.This PR fixes that problem by having the
mml3extension call on#root/root.jsto get its root directory and making a path relative to that, rather than trying to look up the equivalent to__dirnameusingimport.meta.url. That means, in particular, that we don't need the#mml3pseudo-module only longer, so that is removed from thepackage.jsonandtsconfigfiles that included it.In addition, we modify the
root-pack.jsfile (that replaces#root/root.jswhen webpack is used) to look for a MathJax configurationMathJax.config.loader.paths.mathjaxorMathJax.config.__dirname(the latter being set up bynode-main) in order to try harder to find a good value for the root directory when used from webpacked files. Also, theesRoot()function was renamedmjxRoot(), as that is more meaningful.Finally, the
mml3.serf.jsonfile also included full file pathnames based on my own file hierarchy, so the package scripts used to create it have been modified to end up using/tmprather than my full path to MathJax-src, so at least that is more generic.