mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 08:18:50 +00:00
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
var map = require("./map.json");
|
|
var meteorAliases = {};
|
|
|
|
Object.keys(map).forEach(function (id) {
|
|
if (typeof map[id] === "string") {
|
|
var aliasParts = module.id.split("/");
|
|
aliasParts.pop();
|
|
aliasParts.push("node_modules", map[id]);
|
|
exports[id] = meteorAliases[id + ".js"] =
|
|
aliasParts.join("/");
|
|
} else {
|
|
exports[id] = map[id];
|
|
meteorAliases[id + ".js"] = function(){};
|
|
}
|
|
});
|
|
|
|
if (typeof meteorInstall === "function") {
|
|
meteorInstall({
|
|
// Install the aliases into a node_modules directory one level up from
|
|
// the root directory, so that they do not clutter the namespace
|
|
// available to apps and packages.
|
|
"..": {
|
|
node_modules: meteorAliases
|
|
}
|
|
});
|
|
}
|
|
|
|
// If Buffer is not defined globally, but the "buffer" built-in stub is
|
|
// installed and can be imported, use it to define global.Buffer so that
|
|
// modules like core-util-is/lib/util.js can refer to Buffer without
|
|
// crashing application startup.
|
|
if (typeof global.Buffer !== "function") {
|
|
try {
|
|
// Use (0, require)(...) to avoid registering a dependency on the
|
|
// "buffer" stub, in case it is not otherwise bundled.
|
|
global.Buffer = (0, require)("buffer").Buffer;
|
|
} catch (ok) {
|
|
// Failure to import "buffer" is fine as long as the Buffer global
|
|
// variable is not used.
|
|
}
|
|
}
|