SOLVED! See my self-answer below.
I’m building two Metro-style apps using Javascript and HTML, which will have different presentation layers but a lot of similar functionality under the hood. Thanks to the ability to call C# methods from Javascript, I can factor a lot of the “common” functionality into a C# WinMd library that can then be referenced by both top-level apps.
However, there are some utility-type functions that are purely Javascript that I would like to reuse. There doesn’t appear to be a way to create a “WinMD” using Javascript (only C# or C++).
In a .NET world, I would usually just package whatever file as a resource and load it from a common assembly. Is there a way I could add a “common” .js file to a WinMD as a resource, and access it through some app-aware URL (i.e. ms-appx: or ms-resource: or something like that)?
The trick is as follows:
< script src=”ms-appx:///MyWinMdProj/path/to/file.js” >
Note the three slashes; “MyWinMdProj” is a folder relative the Metro app’s package (i.e. ms-appx:///) as opposed to being its own top-level package.
Note that any file included in this manner will be exposed on the filesystem under C:\Program Files\WindowsApps – but all of your html, js, css, etc. files from the top-level app project already are anyway, so you’re not any worse off in that regard than if you copied and pasted the code in between two (or more) different apps.