mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Install Meteor packages into virtual node_modules/meteor/ directory.
Previously Meteor packages were installed at /node_modules/<package-name>. This commit wraps them in an additional directory called "meteor", which prevents their names from colliding with other installed npm package names, and also means Meteor package identifiers must now include the "meteor/" prefix: import Blaze from "meteor/blaze" This change will eventually enable Meteor packages to import npm packages installed in top-level node_modules directories of apps. That won't work just yet, though, because the app bundler doesn't yet know anything about external dependencies imported by packages.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import {AccountsTest} from "accounts-base";
|
||||
import {AccountsTest} from "meteor/accounts-base";
|
||||
|
||||
Tinytest.add("accounts - parse urls for accounts-password",
|
||||
function (test) {
|
||||
|
||||
@@ -203,10 +203,7 @@ export default class ImportScanner {
|
||||
if (this.name) {
|
||||
// If we're bundling a package, prefix path with
|
||||
// node_modules/<package name>/.
|
||||
path = pathJoin("node_modules", this.name, path);
|
||||
} else {
|
||||
// If we're bundling an app, prefix path with app/.
|
||||
path = pathJoin("app", path);
|
||||
path = pathJoin("node_modules", "meteor", this.name, path);
|
||||
}
|
||||
|
||||
return path;
|
||||
@@ -372,9 +369,10 @@ export default class ImportScanner {
|
||||
}
|
||||
|
||||
_getMeteorPackageNameFromId(id) {
|
||||
const possiblePackageName = id.split("/", 1)[0];
|
||||
if (has(this.usedPackageNames, possiblePackageName)) {
|
||||
return possiblePackageName;
|
||||
const [meteor, packageName] = id.split("/", 2);
|
||||
if (meteor === "meteor" &&
|
||||
has(this.usedPackageNames, packageName)) {
|
||||
return packageName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,7 +434,7 @@ export default class ImportScanner {
|
||||
// directories, npm never takes advantage of this possibility, which
|
||||
// conveniently allows Meteor to install files there without conflict.
|
||||
_addMeteorPackageStubToOutput(packageName) {
|
||||
const relPkgPath = pathJoin("node_modules", packageName + ".js");
|
||||
const relPkgPath = pathJoin("node_modules", "meteor", packageName + ".js");
|
||||
const absPkgPath = pathJoin(this.sourceRoot, relPkgPath);
|
||||
|
||||
// Note that this absPkgPath need not actually exist on disk!
|
||||
|
||||
Reference in New Issue
Block a user