Clean up all dependencies

This commit is contained in:
Sashko Stubailo
2015-07-30 17:25:38 -07:00
parent 89184679fd
commit 0ef65cc782
24 changed files with 145 additions and 79 deletions

View File

@@ -62,11 +62,16 @@ Package.onUse(function (api) {
});
Package.onTest(function (api) {
api.use('accounts-base');
api.use('tinytest');
api.use('random');
api.use('test-helpers');
api.use('oauth-encryption');
api.use([
'accounts-base',
'tinytest',
'random',
'test-helpers',
'oauth-encryption',
'underscore',
'ddp'
]);
api.addFiles('accounts_tests.js', 'server');
api.addFiles("accounts_url_tests.js", "client");
});

View File

@@ -12,7 +12,11 @@ Package.onUse(function (api) {
});
Package.onTest(function (api) {
api.use('tinytest');
api.use('binary-heap');
api.use([
'tinytest',
'underscore',
'binary-heap'
]);
api.addFiles('binary-heap-tests.js');
});

View File

@@ -47,6 +47,8 @@ Package.onTest(function (api) {
api.use('blaze-tools'); // for BlazeTools.toJS
api.use('html-tools');
api.use('reactive-var');
api.use('tracker');
api.use('templating');
api.addFiles('view_tests.js');
api.addFiles('render_tests.js', 'client');

View File

@@ -9,6 +9,6 @@ Package.onUse(function (api) {
});
Package.onTest(function (api) {
api.use(["tinytest", "browser-policy", "ejson"], "server");
api.use(["tinytest", "browser-policy", "ejson", "underscore"], "server");
api.addFiles("browser-policy-test.js", "server");
});

View File

@@ -23,8 +23,13 @@ Package.onUse(function (api) {
Package.onTest(function (api) {
api.use('constraint-solver');
api.use(['tinytest', 'minimongo', 'package-version-parser']);
api.use('underscore');
api.use([
'tinytest',
'minimongo',
'package-version-parser',
'underscore',
'check'
]);
// Only test the package on the server. Mainly because of
// package-version-parser, which uses the semver npm module,

View File

@@ -47,7 +47,16 @@ Package.onTest(function (api) {
api.use('livedata', ['client', 'server']);
api.use('mongo', ['client', 'server']);
api.use('test-helpers', ['client', 'server']);
api.use(['underscore', 'tinytest', 'random', 'tracker', 'reactive-var', 'mongo-id', 'diff-sequence']);
api.use([
'underscore',
'tinytest',
'random',
'tracker',
'reactive-var',
'mongo-id',
'diff-sequence',
'ejson'
]);
api.addFiles('stub_stream.js');
api.addFiles('livedata_connection_tests.js', ['client', 'server']);

View File

@@ -13,11 +13,14 @@ Package.onUse(function (api) {
});
Package.onTest(function (api) {
api.use('tinytest');
api.use([
'tinytest',
'underscore',
'ejson'
]);
api.use('diff-sequence');
api.addFiles([
'tests.js'
]);
});

View File

@@ -10,6 +10,7 @@ Package.onUse(function (api) {
Package.onTest(function (api) {
api.use('tinytest');
api.use('underscore');
api.use('geojson-utils');
api.addFiles(['geojson-utils.tests.js'], 'client');
});

View File

@@ -14,7 +14,7 @@ Package.on_use(function (api) {
});
Package.on_test(function (api) {
api.use('tinytest');
api.use(['tinytest', 'check', 'underscore']);
api.use('logic-solver');
// logic-solver is totally meant for the client too, but not old

View File

@@ -7,8 +7,12 @@ Package.onUse(function (api) {
api.use('random');
api.use('service-configuration', ['client', 'server']);
api.use('oauth', ['client', 'server']);
api.use('underscore', 'server');
api.use('http', 'server');
api.use([
'underscore',
'check',
'http'
], 'server');
api.use('mongo');
api.export('OAuth1Binding', 'server');

View File

@@ -14,9 +14,14 @@ Package.onUse(function (api) {
});
Package.onTest(function (api) {
api.use('tinytest');
api.use('observe-sequence');
api.use('underscore');
api.use('ejson');
api.use([
'tinytest',
'observe-sequence',
'underscore',
'ejson',
'tracker',
'mongo'
]);
api.addFiles(['observe_sequence_tests.js'], 'client');
});

View File

@@ -12,6 +12,6 @@ Package.onUse(function (api) {
Package.onTest(function (api) {
api.use('package-version-parser');
api.use(['tinytest']);
api.use(['tinytest', 'underscore']);
api.addFiles('package-version-parser-tests.js', 'server');
});

View File

@@ -15,5 +15,6 @@ Package.onUse(function (api) {
Package.onTest(function (api) {
api.use('tinytest');
api.use('reactive-dict');
api.use('tracker');
api.addFiles('reactive-dict-tests.js');
});

View File

@@ -95,8 +95,8 @@ _.extend(ReactiveDict.prototype, {
// Mongo.ObjectID is in the 'mongo' package
var ObjectID = null;
if (typeof Mongo !== 'undefined') {
ObjectID = Mongo.ObjectID;
if (Package.mongo) {
ObjectID = Package.mongo.Mongo.ObjectID;
}
// We don't allow objects (or arrays that might include objects) for
@@ -114,8 +114,9 @@ _.extend(ReactiveDict.prototype, {
typeof value !== 'undefined' &&
!(value instanceof Date) &&
!(ObjectID && value instanceof ObjectID) &&
value !== null)
value !== null) {
throw new Error("ReactiveDict.equals: value must be scalar");
}
var serializedValue = stringify(value);
if (Tracker.active) {
@@ -139,7 +140,7 @@ _.extend(ReactiveDict.prototype, {
if (_.has(self.keys, key)) oldValue = parse(self.keys[key]);
return EJSON.equals(oldValue, value);
},
all: function() {
this.allDeps.depend();
var ret = {};
@@ -148,21 +149,21 @@ _.extend(ReactiveDict.prototype, {
});
return ret;
},
clear: function() {
var self = this;
var oldKeys = self.keys;
self.keys = {};
self.allDeps.changed();
_.each(oldKeys, function(value, key) {
changed(self.keyDeps[key]);
changed(self.keyValueDeps[key][value]);
changed(self.keyValueDeps[key]['undefined']);
});
},
_setObject: function (object) {

View File

@@ -11,6 +11,6 @@ Package.onUse(function (api) {
Package.onTest(function (api) {
api.addFiles("safetybelt.js", "server", { isAsset: true });
api.use(["reload-safetybelt", "tinytest", "http", "webapp"]);
api.use(["reload-safetybelt", "tinytest", "http", "webapp", "underscore"]);
api.addFiles("reload-safety-belt-tests.js", "server");
});

View File

@@ -23,11 +23,15 @@ Package.onUse(function (api) {
});
Package.onTest(function (api) {
api.use('underscore');
api.use('spacebars-compiler');
api.use('tinytest');
api.use('blaze-tools');
api.use('coffeescript');
api.use([
'underscore',
'spacebars-compiler',
'tinytest',
'blaze-tools',
'coffeescript',
'spacebars',
'blaze'
]);
api.addFiles('spacebars_tests.js');
api.addFiles('compile_tests.js');
api.addFiles('compiler_output_tests.coffee');

View File

@@ -6,17 +6,21 @@ Package.describe({
// These tests are in a separate package to avoid a circular dependency
// between the `spacebars` and `templating` packages.
Package.onTest(function (api) {
api.use('underscore');
api.use('spacebars');
api.use('tinytest');
api.use('jquery');
api.use('test-helpers');
api.use('reactive-var');
api.use('showdown');
api.use('minimongo');
api.use('tracker');
api.use('mongo');
api.use('random');
api.use([
'underscore',
'spacebars',
'tinytest',
'jquery',
'test-helpers',
'reactive-var',
'showdown',
'minimongo',
'tracker',
'mongo',
'random',
'blaze',
'session'
]);
api.use('templating', 'client');
api.addFiles([

View File

@@ -1,22 +0,0 @@
<!-- Expects the data context to have a `template` property (the name of
the template to render) and an optional `data` property. If the `data`
property is not specified, then the parent data context will be used
instead. Uses the __dynamicWithDataContext template below to actually
render the template. -->
<template name="__dynamic">
{{checkContext}}
{{#if dataContextPresent}}
{{> __dynamicWithDataContext}}
{{else}}
{{! if there was no explicit 'data' argument, use the parent context}}
{{> __dynamicWithDataContext template=template data=..}}
{{/if}}
</template>
<!-- Expects the data context to have a `template` property (the name of
the template to render) and a `data` property, which can be falsey. -->
<template name="__dynamicWithDataContext">
{{#with chooseTemplate template}}
{{> .. ../data}} {{!-- The .. is evaluated inside {{#with ../data}} --}}
{{/with}}
</template>

View File

@@ -1,3 +1,5 @@
var Template = Blaze.Template;
/**
* @isTemplate true
* @memberOf Template
@@ -5,9 +7,48 @@
* @summary Choose a template to include dynamically, by name.
* @locus Templates
* @param {String} template The name of the template to include.
* @param {Object} [data] Optional. The data context in which to include the template.
* @param {Object} [data] Optional. The data context in which to include the
* template.
*/
// The compiled version is here to avoid having Spacebars depend on Templating.
// If we split out the build plugin part of templating from the runtime, it
// might be possible to use templating here instead.
Template.__checkName("__dynamic");
Template["__dynamic"] = new Template("Template.__dynamic", (function() {
var view = this;
return [ Blaze.View("lookup:checkContext", function() {
return Spacebars.mustache(view.lookup("checkContext"));
}), "\n ", Blaze.If(function() {
return Spacebars.call(view.lookup("dataContextPresent"));
}, function() {
return [ "\n ", Spacebars.include(view.lookupTemplate("__dynamicWithDataContext")), "\n " ];
}, function() {
return [ "\n \n ", Blaze._TemplateWith(function() {
return {
template: Spacebars.call(view.lookup("template")),
data: Spacebars.call(view.lookup(".."))
};
}, function() {
return Spacebars.include(view.lookupTemplate("__dynamicWithDataContext"));
}), "\n " ];
}) ];
}));
Template.__checkName("__dynamicWithDataContext");
Template["__dynamicWithDataContext"] = new Template("Template.__dynamicWithDataContext", (function() {
var view = this;
return Spacebars.With(function() {
return Spacebars.dataMustache(view.lookup("chooseTemplate"), view.lookup("template"));
}, function() {
return [ "\n ", Blaze._TemplateWith(function() {
return Spacebars.call(Spacebars.dot(view.lookup(".."), "data"));
}, function() {
return Spacebars.include(view.lookupTemplate(".."));
}), " \n " ];
});
}));
Template.__dynamicWithDataContext.helpers({
chooseTemplate: function (name) {
return Blaze._getTemplate(name, function () {

View File

@@ -18,14 +18,13 @@ Package.onUse(function (api) {
api.use('tracker');
api.use('blaze');
api.use('observe-sequence');
api.use('templating');
api.use('underscore');
api.addFiles(['spacebars-runtime.js']);
api.addFiles(['dynamic.html', 'dynamic.js'], 'client');
api.addFiles(['dynamic.js'], 'client');
});
Package.onTest(function (api) {
api.use(["spacebars", "tinytest", "test-helpers", "reactive-var"]);
api.use(["spacebars", "tinytest", "test-helpers", "reactive-var", "tracker"]);
api.use("templating", "client");
api.addFiles(["dynamic_tests.html", "dynamic_tests.js"], "client");
});

View File

@@ -5,7 +5,7 @@ Package.describe({
Package.onUse(function (api) {
api.use('webapp', 'server');
api.use(['ddp'], 'client');
api.use(['ddp', 'tracker'], 'client');
api.use(['callback-hook'], 'client');
api.use(['templating'], 'client');
api.use(['underscore'], ['client', 'server']);
@@ -21,7 +21,7 @@ Package.onUse(function (api) {
});
Package.onTest(function (api) {
api.use(['spiderable', 'tinytest']);
api.use(['spiderable', 'tinytest', 'underscore', 'ddp']);
api.addFiles('spiderable_client_tests.js', 'client');
api.addFiles('spiderable_server_tests.js', 'server');
});

View File

@@ -44,7 +44,7 @@ Package.onUse(function (api) {
// Blaze, so anybody using templating (eg apps) need to implicitly use
// 'meteor' and 'blaze'.
api.use('blaze');
api.imply(['meteor', 'blaze'], 'client');
api.imply(['meteor', 'blaze', 'spacebars'], 'client');
});
Package.onTest(function (api) {

View File

@@ -4,7 +4,7 @@ Package.describe({
});
Package.onUse(function (api) {
api.use(['underscore', 'tracker', 'ejson', 'tinytest', 'random']);
api.use(['underscore', 'tracker', 'ejson', 'tinytest', 'random', 'blaze']);
api.use(['jquery'], 'client');
// XXX for connection.js. Not sure this really belongs in

View File

@@ -37,7 +37,7 @@ Package.onUse(function (api) {
});
Package.onTest(function (api) {
api.use(['tinytest', 'webapp', 'http']);
api.use(['tinytest', 'webapp', 'http', 'underscore']);
api.addFiles('webapp_tests.js', 'server');
api.addFiles('webapp_client_tests.js', 'client');
});