mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
__meteor_bootstrap__.bundle -> WebApp.clientProgram
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
var bundle = __meteor_bootstrap__.bundle;
|
||||
var crypto = Npm.require('crypto');
|
||||
var fs = Npm.require('fs');
|
||||
var path = Npm.require('path');
|
||||
@@ -97,7 +96,7 @@ WebApp.connectHandlers.use(function(req, res, next) {
|
||||
|
||||
var hash = crypto.createHash('sha1');
|
||||
hash.update(JSON.stringify(__meteor_runtime_config__), 'utf8');
|
||||
_.each(bundle.manifest, function (resource) {
|
||||
_.each(WebApp.clientProgram.manifest, function (resource) {
|
||||
if (resource.where === 'client' || resource.where === 'internal') {
|
||||
hash.update(resource.hash);
|
||||
}
|
||||
@@ -109,7 +108,7 @@ WebApp.connectHandlers.use(function(req, res, next) {
|
||||
|
||||
manifest += "CACHE:" + "\n";
|
||||
manifest += "/" + "\n";
|
||||
_.each(bundle.manifest, function (resource) {
|
||||
_.each(WebApp.clientProgram.manifest, function (resource) {
|
||||
if (resource.where === 'client' &&
|
||||
! RoutePolicy.classify(resource.url)) {
|
||||
manifest += resource.url;
|
||||
@@ -138,7 +137,7 @@ WebApp.connectHandlers.use(function(req, res, next) {
|
||||
// request to the server and have the asset served from cache by
|
||||
// specifying the full URL with hash in their code (manually, with
|
||||
// some sort of URL rewriting helper)
|
||||
_.each(bundle.manifest, function (resource) {
|
||||
_.each(WebApp.clientProgram.manifest, function (resource) {
|
||||
if (resource.where === 'client' &&
|
||||
! RoutePolicy.classify(resource.url) &&
|
||||
!resource.cacheable) {
|
||||
@@ -174,7 +173,7 @@ WebApp.connectHandlers.use(function(req, res, next) {
|
||||
|
||||
var sizeCheck = function() {
|
||||
var totalSize = 0;
|
||||
_.each(bundle.manifest, function (resource) {
|
||||
_.each(WebApp.clientProgram.manifest, function (resource) {
|
||||
if (resource.where === 'client') {
|
||||
totalSize += resource.size;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ Package.describe({
|
||||
|
||||
Package.on_use(function (api) {
|
||||
api.use('underscore', 'server');
|
||||
// Resolve circular dependency with webapp. We can only use WebApp via
|
||||
// Package.webapp and only after initial load.
|
||||
api.use('webapp', 'server', {unordered: true});
|
||||
api.add_files('routepolicy.js', 'server');
|
||||
});
|
||||
|
||||
|
||||
@@ -63,14 +63,17 @@ _.extend(_RoutePolicyConstructor.prototype, {
|
||||
var self = this;
|
||||
if (type === 'static-online')
|
||||
return null;
|
||||
if (typeof __meteor_bootstrap__ === "undefined" ||
|
||||
!__meteor_bootstrap__.bundle || !__meteor_bootstrap__.bundle.manifest)
|
||||
if (!Package.webapp || !Package.webapp.WebApp
|
||||
|| !Package.webapp.WebApp.clientProgram
|
||||
|| !Package.webapp.WebApp.clientProgram.manifest) {
|
||||
// Hack: If we don't have a manifest, deal with it
|
||||
// gracefully. This lets us load livedata into a nodejs
|
||||
// environment that doesn't have a HTTP server (eg, a
|
||||
// command-line tool).
|
||||
return null;
|
||||
var manifest = _testManifest || __meteor_bootstrap__.bundle.manifest;
|
||||
}
|
||||
var manifest =
|
||||
_testManifest || Package.webapp.WebApp.clientProgram.manifest;
|
||||
var conflict = _.find(manifest, function (resource) {
|
||||
return (resource.type === 'static' &&
|
||||
resource.where === 'client' &&
|
||||
|
||||
@@ -284,6 +284,12 @@ var runWebAppServer = function () {
|
||||
_.extend(WebApp, {
|
||||
connectHandlers: packageAndAppHandlers,
|
||||
httpServer: httpServer,
|
||||
// metadata about the client program that we serve
|
||||
clientProgram: {
|
||||
manifest: clientJson.manifest
|
||||
// XXX do we need a "root: clientDir" field here? it used to be here but
|
||||
// was unused.
|
||||
},
|
||||
// For testing.
|
||||
suppressConnectErrors: function () {
|
||||
suppressConnectErrors = true;
|
||||
@@ -294,13 +300,6 @@ var runWebAppServer = function () {
|
||||
__basicAuth__: connect.basicAuth
|
||||
});
|
||||
_.extend(__meteor_bootstrap__, {
|
||||
// metadata about this bundle
|
||||
// XXX this could use some refactoring to better distinguish
|
||||
// server and client
|
||||
bundle: {
|
||||
manifest: clientJson.manifest,
|
||||
root: clientDir
|
||||
},
|
||||
// function that takes a connect `req` object and returns a summary
|
||||
// object with information about the request. See
|
||||
// #BrowserIdentifcation
|
||||
|
||||
Reference in New Issue
Block a user