mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Move uniload package list to uniload.js
Actually verify that uniloaded packages are in the list. Add missing 'ejson'. Remove (ah well) test that relies on ability to uniload an app package (which shouldn't work anyway, but it would be nice to test uniload Assets...)
This commit is contained in:
@@ -3,15 +3,4 @@ Package.describe({
|
||||
version: '1.0.9'
|
||||
});
|
||||
|
||||
Package.includeTool([
|
||||
'meteor',
|
||||
'livedata',
|
||||
'minifiers',
|
||||
'dev-bundle-fetcher',
|
||||
'js-analyze',
|
||||
'logging',
|
||||
'mongo-livedata',
|
||||
'minimongo',
|
||||
'constraint-solver',
|
||||
'package-version-parser'
|
||||
]);
|
||||
Package.includeTool();
|
||||
|
||||
@@ -275,12 +275,11 @@ var PackageSource = function (catalog) {
|
||||
// to the catalog), so we need to keep track of them.
|
||||
self.isTest = false;
|
||||
|
||||
// If this is set, it should be set to an array of package names. We will take
|
||||
// the currently running git checkout and bundle the meteor tool from it
|
||||
// inside this package as a tool. We will include built unipackages for all
|
||||
// the packages in this array as well as their transitive (strong)
|
||||
// dependencies.
|
||||
self.includeTool = null;
|
||||
// If this is set, we will take the currently running git checkout and bundle
|
||||
// the meteor tool from it inside this package as a tool. We will include
|
||||
// built unipackages for all the packages in uniload.ROOT_PACKAGES as well as
|
||||
// their transitive (strong) dependencies.
|
||||
self.includeTool = false;
|
||||
|
||||
// If this is true, then this package has no source files. (But the converse
|
||||
// is not true: this is only set to true by one particular constructor.) This
|
||||
@@ -580,19 +579,14 @@ _.extend(PackageSource.prototype, {
|
||||
self.pluginInfo[options.name] = options;
|
||||
},
|
||||
|
||||
includeTool: function (packages) {
|
||||
includeTool: function () {
|
||||
if (!files.inCheckout()) {
|
||||
buildmessage.error("Package.includeTool() can only be used with a " +
|
||||
"checkout of meteor");
|
||||
} else if (self.includeTool) {
|
||||
buildmessage.error("Duplicate includeTool call");
|
||||
} else if (!_.isArray(packages)) {
|
||||
buildmessage.error("Argument to Package.includeTool must be array");
|
||||
} else if (!_.all(packages, _.isString)) {
|
||||
buildmessage.error(
|
||||
"Elements of array passed to Package.includeTool must be strings");
|
||||
} else {
|
||||
self.includeTool = packages;
|
||||
self.includeTool = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -144,15 +144,6 @@ var runTest = function () {
|
||||
});
|
||||
assert.strictEqual(fut.wait(), 0);
|
||||
});
|
||||
|
||||
console.log("Use Assets API from unipackage");
|
||||
assert.doesNotThrow(function () {
|
||||
var testPackage = uniload.load({
|
||||
library: release.current.library,
|
||||
packages: ['test-package']
|
||||
})['test-package'].TestAsset;
|
||||
testPackage.go(false /* don't exit when done */);
|
||||
});
|
||||
};
|
||||
|
||||
var Fiber = require('fibers');
|
||||
|
||||
@@ -6,6 +6,23 @@ var packageLoader = require("./package-loader.js");
|
||||
var files = require('./files.js');
|
||||
var catalog = require('./catalog.js');
|
||||
|
||||
// These are the only packages that may be directly loaded via this package. Add
|
||||
// more to the list if you need to uniload more things! (You don't have to
|
||||
// include the dependencies of the packages you directly load in this list.)
|
||||
var ROOT_PACKAGES = [
|
||||
'constraint-solver',
|
||||
'dev-bundle-fetcher',
|
||||
'ejson',
|
||||
'js-analyze',
|
||||
'livedata',
|
||||
'logging',
|
||||
'meteor',
|
||||
'minifiers',
|
||||
'minimongo',
|
||||
'mongo-livedata',
|
||||
'package-version-parser'
|
||||
];
|
||||
|
||||
// Load unipackages into the currently running node.js process. Use
|
||||
// this to use unipackages (such as the DDP client) from command-line
|
||||
// tools (such as 'meteor'). The requested packages will be loaded
|
||||
@@ -56,6 +73,12 @@ var load = function (options) {
|
||||
return cache[cacheKey];
|
||||
}
|
||||
|
||||
var undeclaredPackages = _.difference(options.packages, ROOT_PACKAGES);
|
||||
if (undeclaredPackages.length) {
|
||||
throw new Error("attempt to uniload undeclared packages: " +
|
||||
JSON.stringify(undeclaredPackages));
|
||||
}
|
||||
|
||||
// Set up a minimal server-like environment (omitting the parts that
|
||||
// are specific to the HTTP server). Kind of a hack. I suspect this
|
||||
// will get refactored before too long. Note that
|
||||
@@ -120,5 +143,6 @@ var load = function (options) {
|
||||
|
||||
var uniload = exports;
|
||||
_.extend(exports, {
|
||||
load: load
|
||||
load: load,
|
||||
ROOT_PACKAGES: ROOT_PACKAGES
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ var watch = require('./watch.js');
|
||||
var packageLoader = require('./package-loader.js');
|
||||
var catalog = require('./catalog.js');
|
||||
var files = require('./files.js');
|
||||
var uniload = require('./uniload.js');
|
||||
var Future = require('fibers/future');
|
||||
|
||||
var rejectBadPath = function (p) {
|
||||
@@ -263,7 +264,7 @@ var Unipackage = function () {
|
||||
// See description in PackageSource. If this is set, then we include a copy of
|
||||
// our own source, in addition to any other tools that were originally in the
|
||||
// unipackage.
|
||||
self.includeTool = null;
|
||||
self.includeTool = false;
|
||||
|
||||
// This is tools to copy from trees on disk. This is used by the
|
||||
// unipackage-merge code in tropohouse.
|
||||
@@ -970,7 +971,7 @@ _.extend(Unipackage.prototype, {
|
||||
catalog: catalog.uniload
|
||||
});
|
||||
bundler.iterateOverAllUsedUnipackages(
|
||||
localPackageLoader, archinfo.host(), self.includeTool,
|
||||
localPackageLoader, archinfo.host(), uniload.ROOT_PACKAGES,
|
||||
function (unipkg) {
|
||||
// XXX assert that each name shows up once
|
||||
unipkg.saveToPath(path.join(unipath, unipkg.name), {
|
||||
|
||||
Reference in New Issue
Block a user