mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
PackageSource and buildJsImage don't need catalog
It wasn't really being used for anything anymore except complaining about api.versionsFrom being used during isopacket builds, which is now implemented in a simpler way.
This commit is contained in:
@@ -167,7 +167,6 @@ var runLog = require('./run-log.js');
|
||||
var PackageSource = require('./package-source.js');
|
||||
var compiler = require('./compiler.js');
|
||||
var tropohouse = require('./tropohouse.js');
|
||||
var catalog = require('./catalog.js');
|
||||
var packageVersionParser = require('./package-version-parser.js');
|
||||
|
||||
// files to ignore when bundling. node has no globs, so use regexps
|
||||
@@ -2004,7 +2003,7 @@ exports.bundle = function (options) {
|
||||
};
|
||||
|
||||
// Create a Isopack object that represents the app
|
||||
var packageSource = new PackageSource(projectContext.packageMap.catalog);
|
||||
var packageSource = new PackageSource;
|
||||
packageSource.initFromAppDir(projectContext, exports.ignoreFiles);
|
||||
var app = compiler.compile(packageSource, {
|
||||
packageMap: projectContext.packageMap,
|
||||
@@ -2133,10 +2132,8 @@ exports.buildJsImage = function (options) {
|
||||
throw new Error("Must indicate .npm directory to use");
|
||||
if (! options.name)
|
||||
throw new Error("Must provide a name");
|
||||
if (! options.catalog)
|
||||
throw new Error("Must provide a catalog");
|
||||
|
||||
var packageSource = new PackageSource(options.catalog);
|
||||
var packageSource = new PackageSource;
|
||||
|
||||
packageSource.initFromOptions(options.name, {
|
||||
kind: "plugin",
|
||||
|
||||
@@ -75,6 +75,7 @@ _.extend(LocalCatalog.prototype, {
|
||||
// - explicitlyAddedLocalPackageDirs: an array of paths which THEMSELVES
|
||||
// are package source trees. Takes precedence over packages found
|
||||
// via localPackageSearchDirs.
|
||||
// - buildingIsopackets: true if we are building isopackets
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
buildmessage.assertInCapture();
|
||||
@@ -91,7 +92,7 @@ _.extend(LocalCatalog.prototype, {
|
||||
});
|
||||
|
||||
self._computeEffectiveLocalPackages();
|
||||
self._loadLocalPackages();
|
||||
self._loadLocalPackages(options.buildingIsopackets);
|
||||
self.initialized = true;
|
||||
},
|
||||
|
||||
@@ -240,9 +241,8 @@ _.extend(LocalCatalog.prototype, {
|
||||
});
|
||||
},
|
||||
|
||||
_loadLocalPackages: function (options) {
|
||||
_loadLocalPackages: function (buildingIsopackets) {
|
||||
var self = this;
|
||||
options = options || {};
|
||||
buildmessage.assertInCapture();
|
||||
|
||||
// Load the package source from a directory. We don't know the names of our
|
||||
@@ -256,19 +256,21 @@ _.extend(LocalCatalog.prototype, {
|
||||
// checkout. It is not clear that you get good UX if you have two packages
|
||||
// with the same name in your app. We don't check that.)
|
||||
var initSourceFromDir = function (packageDir, definiteName) {
|
||||
var packageSource = new PackageSource(self.containingCatalog);
|
||||
var packageSource = new PackageSource;
|
||||
buildmessage.enterJob({
|
||||
title: "reading package from `" + packageDir + "`",
|
||||
rootPath: packageDir
|
||||
}, function () {
|
||||
var packageSourceOptions = {};
|
||||
var initFromPackageDirOptions = {
|
||||
buildingIsopackets: !! buildingIsopackets
|
||||
};
|
||||
// If we specified a name, then we know what we want to get and should
|
||||
// pass that into the options. Otherwise, we will use the 'name'
|
||||
// attribute from package-source.js.
|
||||
if (definiteName) {
|
||||
packageSourceOptions.name = definiteName;
|
||||
initFromPackageDirOptions.name = definiteName;
|
||||
}
|
||||
packageSource.initFromPackageDir(packageDir, packageSourceOptions);
|
||||
packageSource.initFromPackageDir(packageDir, initFromPackageDirOptions);
|
||||
if (buildmessage.jobHasMessages())
|
||||
return; // recover by ignoring
|
||||
|
||||
|
||||
@@ -57,8 +57,7 @@ compiler.compile = function (packageSource, options) {
|
||||
// rest of the package, so they need their own separate npm
|
||||
// shrinkwrap and cache state.
|
||||
npmDir: path.resolve(path.join(packageSource.sourceRoot, '.npm',
|
||||
'plugin', info.name)),
|
||||
catalog: packageSource.catalog
|
||||
'plugin', info.name))
|
||||
});
|
||||
if (buildmessage.jobHasMessages())
|
||||
return;
|
||||
|
||||
@@ -1091,8 +1091,7 @@ _.extend(Isopack.prototype, {
|
||||
name: "isopacket-" + isopacketName,
|
||||
packageMap: packageMap,
|
||||
isopackCache: isopackCache,
|
||||
use: packages,
|
||||
catalog: isopacketCatalog
|
||||
use: packages
|
||||
}).image;
|
||||
if (buildmessage.jobHasMessages())
|
||||
return;
|
||||
|
||||
@@ -182,8 +182,7 @@ var ensureIsopacketsLoadable = function () {
|
||||
name: "isopacket-" + isopacketName,
|
||||
packageMap: packageMap,
|
||||
isopackCache: isopackCache,
|
||||
use: packages,
|
||||
catalog: isopacketCatalog
|
||||
use: packages
|
||||
});
|
||||
if (buildmessage.jobHasMessages())
|
||||
return;
|
||||
@@ -218,7 +217,6 @@ var newIsopacketBuildingCatalog = function () {
|
||||
|
||||
var catalogLocal = require('./catalog-local.js');
|
||||
var isopacketCatalog = new catalogLocal.LocalCatalog;
|
||||
isopacketCatalog.isopacketBuildingCatalog = true;
|
||||
var messages = buildmessage.capture(
|
||||
{ title: "Scanning local core packages" },
|
||||
function () {
|
||||
@@ -229,7 +227,8 @@ var newIsopacketBuildingCatalog = function () {
|
||||
// (there's no worries about needing to springboard).
|
||||
isopacketCatalog.initialize({
|
||||
localPackageSearchDirs: [path.join(
|
||||
files.getCurrentToolsDir(), 'packages')]
|
||||
files.getCurrentToolsDir(), 'packages')],
|
||||
buildingIsopackets: true
|
||||
});
|
||||
});
|
||||
if (messages.hasMessages()) {
|
||||
|
||||
@@ -190,14 +190,9 @@ var SourceArch = function (pkg, options) {
|
||||
// PackageSource
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var PackageSource = function (catalog) {
|
||||
var PackageSource = function () {
|
||||
var self = this;
|
||||
|
||||
// Which catalog this PackageSource works with.
|
||||
if (!catalog)
|
||||
throw Error("Must provide catalog");
|
||||
self.catalog = catalog;
|
||||
|
||||
// The name of the package, or null for an app pseudo-package or
|
||||
// collection. The package's exports will reside in Package.<name>.
|
||||
// When it is null it is linked like an application instead of like
|
||||
@@ -372,12 +367,15 @@ _.extend(PackageSource.prototype, {
|
||||
// name: name of the package.
|
||||
// dir: location of directory on disk.
|
||||
// options:
|
||||
// -name: override the name of this package with a different name.
|
||||
// - name: override the name of this package with a different name.
|
||||
// - buildingIsopackets: true if this is being scanned in the process
|
||||
// of building isopackets
|
||||
initFromPackageDir: function (dir, options) {
|
||||
var self = this;
|
||||
buildmessage.assertInCapture();
|
||||
var isPortable = true;
|
||||
options = options || {};
|
||||
var initFromPackageDirOptions = options;
|
||||
|
||||
// If we know what package we are initializing, we pass in a
|
||||
// name. Otherwise, we are intializing the base package specified by 'name:'
|
||||
@@ -1183,7 +1181,7 @@ _.extend(PackageSource.prototype, {
|
||||
// (since we may need the ddp isopacket to refresh catalog.official),
|
||||
// so we wouldn't actually be able to interpret the release name
|
||||
// anyway.
|
||||
if (self.catalog.isopacketBuildingCatalog) {
|
||||
if (initFromPackageDirOptions.buildingIsopackets) {
|
||||
buildmessage.error(
|
||||
"packages in isopackets may not use versionsFrom");
|
||||
// recover by ignoring
|
||||
|
||||
Reference in New Issue
Block a user