mirror of
https://github.com/meteor/meteor.git
synced 2026-01-11 00:28:02 -05:00
Wrap Module.prototype.require instead of using options.wrapRequire.
a630b5c2ac7a9abeca88
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"install": {
|
||||
"version": "0.11.1",
|
||||
"resolved": "https://registry.npmjs.org/install/-/install-0.11.1.tgz",
|
||||
"integrity": "sha512-T562YLqjg/ixCFIcqxjFy2dWkulV5o6gDkKTUbUZU4O/JlrzpDMWqR8sR1BPVeb+SAXoQ6scv09MxY2XOzknQQ=="
|
||||
"version": "0.12.0",
|
||||
"resolved": "https://registry.npmjs.org/install/-/install-0.12.0.tgz",
|
||||
"integrity": "sha512-KOKFSWPANzP4XIbBnaRqIiMaCZmPxJEE0HbRrZ8MEt5Z9g4TdXA3LRAHBhb6UH7d8Ig9aSWwrD0Dy2Y3rPKs9w=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// On the client, make package resolution prefer the "browser" field of
|
||||
// package.json files to the "main" field.
|
||||
makeInstallerOptions.browser = true;
|
||||
meteorInstall = makeInstaller({
|
||||
// On the client, make package resolution prefer the "browser" field of
|
||||
// package.json files to the "main" field.
|
||||
browser: true,
|
||||
|
||||
makeInstallerOptions.fallback = function (id, parentId, error) {
|
||||
if (id && id.startsWith('meteor/')) {
|
||||
var packageName = id.split('/', 2)[1];
|
||||
throw new Error(
|
||||
'Cannot find package "' + packageName + '". ' +
|
||||
'Try "meteor add ' + packageName + '".'
|
||||
);
|
||||
fallback: function(id, parentId, error) {
|
||||
if (id && id.startsWith('meteor/')) {
|
||||
var packageName = id.split('/', 2)[1];
|
||||
throw new Error(
|
||||
'Cannot find package "' + packageName + '". ' +
|
||||
'Try "meteor add ' + packageName + '".'
|
||||
);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
throw error;
|
||||
};
|
||||
|
||||
meteorInstall = makeInstaller(makeInstallerOptions);
|
||||
});
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
makeInstallerOptions = {};
|
||||
|
||||
if (typeof Profile === "function" &&
|
||||
process.env.METEOR_PROFILE) {
|
||||
makeInstallerOptions.wrapRequire = function (require) {
|
||||
return Profile(function (id) {
|
||||
return "require(" + JSON.stringify(id) + ")";
|
||||
}, require);
|
||||
};
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
Package.describe({
|
||||
name: "modules-runtime",
|
||||
version: "0.10.1",
|
||||
version: "0.10.2",
|
||||
summary: "CommonJS module system",
|
||||
git: "https://github.com/benjamn/install",
|
||||
documentation: "README.md"
|
||||
});
|
||||
|
||||
Npm.depends({
|
||||
install: "0.11.1"
|
||||
install: "0.12.0"
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
@@ -18,9 +18,9 @@ Package.onUse(function(api) {
|
||||
bare: true
|
||||
});
|
||||
|
||||
api.addFiles("options.js");
|
||||
api.addFiles("client.js", "client");
|
||||
api.addFiles("server.js", "server");
|
||||
api.addFiles("profile.js");
|
||||
|
||||
api.export("meteorInstall");
|
||||
});
|
||||
|
||||
7
packages/modules-runtime/profile.js
Normal file
7
packages/modules-runtime/profile.js
Normal file
@@ -0,0 +1,7 @@
|
||||
if (typeof Profile === "function" &&
|
||||
process.env.METEOR_PROFILE) {
|
||||
var Mp = meteorInstall.Module.prototype;
|
||||
Mp.require = Profile(function (id) {
|
||||
return "require(" + JSON.stringify(id) + ")";
|
||||
}, Mp.require);
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
// Options that will be populated below and then passed to makeInstaller.
|
||||
var makeInstallerOptions = {};
|
||||
|
||||
// RegExp matching strings that don't start with a `.` or a `/`.
|
||||
var topLevelIdPattern = /^[^./]/;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user