This misunderstanding of CommonJS module identifiers goes back to 2012:
8f83b2c32e
In Node, CommonJS module identifiers are always delimited by forward
slashes, even on Windows. Using path.join to abstract away the choice of
platform-specific delimiter is therefore pointless.
While this usage of path.join was always pointless, it was also mostly
harmless until #9095, when we stopped falling back to Node's native
`require` function to handle e.g. `Npm.require("fibers\\future")`. That PR
made the misuse problematic on Windows, so this commit fixes that.
A fix to the dynamic-import code to correctly detect modules version.
Without this fix dynamic-import can't detect correctly modules versions
which breaks the dynamic-import cache functionality.
Ever since Meteor 1.3 first introduced a module system based on something
other than `Npm.require`, we've continued throwing missing module
exceptions that refer to `Npm.depends` and/or `Npm.require`, even if the
developer called `require` or used an `import` declaration. This commit
fixes that, so that all missing module exceptions look like 'Cannot find
module "module/name"'.
I also noticed recently that `Npm.require` is capable of returning modules
installed in `node_modules` directories completely outside the app, which
is bad news for development/production reproducibility. Fixed that too.
CC @hwillson who has spoken of deprecating `Npm.require` entirely, and
just using `require` everywhere, instead.
When running the `ddp-client` package tests with
`meteor test-packages`, and accessing the test runner
via http://127.0.0.1:3000, the websocket endpoint test
fails due to a CORS error. This PR replaces the use of
`Meteor.absoluteUrl` with `Meteor._relativeToSiteRootUrl`
to make sure test HTTP requests are kept within CORS
restrictions.
Fixes#8094.
The `localIp` constant was never used, so the HTTP server was started with an `undefined` host instead of "0.0.0.0" if `process.env.BIND_IP` was `undefined`.
`force-ssl`'s current `isLocalConnection` regex does not handle
IPv4-mapped and/or IPv4-compatible IPv6 addresses, when checking
if the connection is local. This means a local address of
`::ffff:127.0.0.1` is being marked as non-local. These changes
adjust the `isLocalConnection` regex to handle a wider range of
localhost address representations.
Fixes#9072.