[BREAK] Update to Meteor to 1.8 (#12468)
* Update livechat widget to Meteor 1.8 * Replace synced-cron package * Add break change regarding cordova apppull/12371/head^2
parent
727375b093
commit
afd747dde8
@ -1,3 +1,2 @@ |
||||
browser |
||||
ios |
||||
server |
||||
|
||||
@ -1 +1 @@ |
||||
METEOR@1.6.1.3 |
||||
METEOR@1.8 |
||||
|
||||
@ -1,2 +1,2 @@ |
||||
packages/rocketchat-theme/client/vendor/fontello/css/fontello.css |
||||
packages/rocketchat_theme/client/vendor/fontello/css/fontello.css |
||||
packages/meteor-autocomplete/client/autocomplete.css |
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@ |
||||
.build* |
||||
@ -1,115 +0,0 @@ |
||||
# QA Notes |
||||
## Hot Code Push Reload |
||||
|
||||
Run the leaderboard example, and click on one of the names. Make a |
||||
change to the leaderboard.html file, see the client reload, and see |
||||
that the name is still selected. |
||||
|
||||
|
||||
## AUTOUPDATE_VERSION |
||||
|
||||
Set the `AUTOUPDATE_VERSION` environment variable when running the |
||||
application: |
||||
|
||||
$ AUTOUPDATE_VERSION=abc meteor |
||||
|
||||
Now when you make an HTML change, it won't appear in the client |
||||
automatically. (Note the leader list flickers when the server |
||||
subscription restarts, but that's not a window reload). |
||||
|
||||
Conversely, you can force a client reload (even without making any |
||||
client code changes) by restarting the server with a new value for |
||||
`AUTOUPDATE_VERSION`. |
||||
|
||||
|
||||
## No Client Reload on Server-only Change |
||||
|
||||
Revert previous changes and run the example without setting |
||||
AUTOUPDATE_VERSION. |
||||
|
||||
Note that it might look like the browser is reloading because the page |
||||
content in the leaderboard example will flicker when the server |
||||
restarts because the example is using autopublish, but that the window |
||||
won't actually be reloading. |
||||
|
||||
In the browser console, assign a variable such as `a = true` so that |
||||
you can easily verify that the client hasn't reloaded. |
||||
|
||||
In the leaderboard example directory, create the `server` directory |
||||
and add `foo.js`. See in the browser console that `a` is still |
||||
defined, indicating the browser hasn't reloaded. |
||||
|
||||
|
||||
## Test with the appcache |
||||
|
||||
Add the appcache package: |
||||
|
||||
$ meteor add appcache |
||||
|
||||
And do the above tests again. |
||||
|
||||
Note that if 1) AUTOUPDATE_VERSION is set so the client doesn't |
||||
automatically reload, 2) you make a client change, and 3) you manually |
||||
reload the browser page, you usually *won't* see the updated HTML the |
||||
*first* time you reload (unless the browser happened to check the app |
||||
cache manifest between steps 2 and 3). This is normal browser app |
||||
cache behavior: the browser populates the app cache in the background, |
||||
so it doesn't wait for new files to download before displaying the web |
||||
page. |
||||
|
||||
|
||||
## Autoupdate.newClientAvailable |
||||
|
||||
Undo previous changes made, such as by using `git checkout .` Reload |
||||
the client, which will cause the browser to stop using the app cache. |
||||
|
||||
It's hard to see the `newClientAvailable` reactive variable when the |
||||
client automatically reloads. Remove the `hot-code-push` package so you can |
||||
see the variable without having the client also reload. |
||||
|
||||
$ meteor remove meteor-base |
||||
$ meteor add meteor webapp ddp autoupdate |
||||
|
||||
Add to leaderboard.js: |
||||
|
||||
Template.leaderboard.helpers({ |
||||
available: function () { |
||||
return Autoupdate.newClientAvailable().toString(); |
||||
} |
||||
}); |
||||
|
||||
And add `{{available}}` to the leaderboard template in |
||||
leaderboard.html. |
||||
|
||||
Initially you'll see `false`, and then when you make a change to the |
||||
leaderboard HTML you'll see the variable change to `true`. (You won't |
||||
see the new HTML on the client because you disabled reload). |
||||
|
||||
Amusingly, you can undo the addition you made to the HTML and the "new |
||||
client available" variable will go back to `false` (you now don't have |
||||
client code available on the server different than what's running in |
||||
the browser), because by default the client version is based on a hash |
||||
of the client files. |
||||
|
||||
|
||||
## DDP Version Negotiation Failure |
||||
|
||||
A quick way to test DDP version negotiation failure is to force the |
||||
client to use the wrong DDP version. At the top of |
||||
livedata_connection.js: |
||||
|
||||
var Connection = function (url, options) { |
||||
var self = this; |
||||
+ options.supportedDDPVersions = ['abc']; |
||||
|
||||
You will see the client reload (in the hope that new client code will |
||||
be available that can successfully negotiation the DDP version). Each |
||||
reload takes longer than the one before, using an exponential backoff. |
||||
|
||||
If you remove the `options.supportedDDPVersions` line and allow the |
||||
client to connect (or manually reload the browser page so you don't |
||||
have to wait), this will reset the exponential backoff counter. |
||||
|
||||
You can verify the counter was reset by adding the line back in a |
||||
second time, and you'll see the reload cycle start over again with |
||||
first reloading quickly, and then again taking longer between tries. |
||||
@ -1,13 +0,0 @@ |
||||
# autoupdate |
||||
[Source code of released version](https://github.com/meteor/meteor/tree/master/packages/autoupdate) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/autoupdate) |
||||
*** |
||||
|
||||
This package is the heart of Meteor's Hot Code Push functionality. It has a |
||||
client component and a server component component. The client component uses a |
||||
DDP API provided by the server to subscribe to the version ID of the most recent |
||||
build of the app's client. When it sees that a new version is available, it uses |
||||
the [reload](https://atmospherejs.com/meteor/reload) package (if included in the |
||||
app) to gracefully save the app's state and reload it in place. |
||||
|
||||
`autoupdate` is part of the [Webapp](https://github.com/meteor/meteor/tree/master/packages/webapp) |
||||
project. |
||||
@ -1,176 +0,0 @@ |
||||
// Subscribe to the `meteor_autoupdate_clientVersions` collection,
|
||||
// which contains the set of acceptable client versions.
|
||||
//
|
||||
// A "hard code push" occurs when the running client version is not in
|
||||
// the set of acceptable client versions (or the server updates the
|
||||
// collection, there is a published client version marked `current` and
|
||||
// the running client version is no longer in the set).
|
||||
//
|
||||
// When the `reload` package is loaded, a hard code push causes
|
||||
// the browser to reload, so that it will load the latest client
|
||||
// version from the server.
|
||||
//
|
||||
// A "soft code push" represents the situation when the running client
|
||||
// version is in the set of acceptable versions, but there is a newer
|
||||
// version available on the server.
|
||||
//
|
||||
// `Autoupdate.newClientAvailable` is a reactive data source which
|
||||
// becomes `true` if there is a new version of the client is available on
|
||||
// the server.
|
||||
//
|
||||
// This package doesn't implement a soft code reload process itself,
|
||||
// but `newClientAvailable` could be used for example to display a
|
||||
// "click to reload" link to the user.
|
||||
|
||||
// The client version of the client code currently running in the
|
||||
// browser.
|
||||
var autoupdateVersion = __meteor_runtime_config__.autoupdateVersion || "unknown"; |
||||
var autoupdateVersionRefreshable = |
||||
__meteor_runtime_config__.autoupdateVersionRefreshable || "unknown"; |
||||
|
||||
// The collection of acceptable client versions.
|
||||
ClientVersions = new Mongo.Collection("meteor_autoupdate_clientVersions"); |
||||
|
||||
Autoupdate = {}; |
||||
|
||||
Autoupdate.newClientAvailable = function () { |
||||
return !! ClientVersions.findOne({ |
||||
_id: "version", |
||||
version: {$ne: autoupdateVersion} }) || |
||||
!! ClientVersions.findOne({ |
||||
_id: "version-refreshable", |
||||
version: {$ne: autoupdateVersionRefreshable} }); |
||||
}; |
||||
Autoupdate._ClientVersions = ClientVersions; // Used by a self-test
|
||||
|
||||
var knownToSupportCssOnLoad = false; |
||||
|
||||
var retry = new Retry({ |
||||
// Unlike the stream reconnect use of Retry, which we want to be instant
|
||||
// in normal operation, this is a wacky failure. We don't want to retry
|
||||
// right away, we can start slowly.
|
||||
//
|
||||
// A better way than timeconstants here might be to use the knowledge
|
||||
// of when we reconnect to help trigger these retries. Typically, the
|
||||
// server fixing code will result in a restart and reconnect, but
|
||||
// potentially the subscription could have a transient error.
|
||||
minCount: 0, // don't do any immediate retries
|
||||
baseTimeout: 30*1000 // start with 30s
|
||||
}); |
||||
var failures = 0; |
||||
|
||||
function after(times, func) { |
||||
return function() { |
||||
if (--times < 1) { |
||||
return func.apply(this, arguments); |
||||
} |
||||
}; |
||||
}; |
||||
|
||||
Autoupdate._retrySubscription = function () { |
||||
Meteor.subscribe("meteor_autoupdate_clientVersions", { |
||||
onError: function (error) { |
||||
Meteor._debug("autoupdate subscription failed:", error); |
||||
failures++; |
||||
retry.retryLater(failures, function () { |
||||
// Just retry making the subscription, don't reload the whole
|
||||
// page. While reloading would catch more cases (for example,
|
||||
// the server went back a version and is now doing old-style hot
|
||||
// code push), it would also be more prone to reload loops,
|
||||
// which look really bad to the user. Just retrying the
|
||||
// subscription over DDP means it is at least possible to fix by
|
||||
// updating the server.
|
||||
Autoupdate._retrySubscription(); |
||||
}); |
||||
}, |
||||
onReady: function () { |
||||
if (Package.reload) { |
||||
var checkNewVersionDocument = function (doc) { |
||||
var self = this; |
||||
if (doc._id === 'version-refreshable' && |
||||
doc.version !== autoupdateVersionRefreshable) { |
||||
autoupdateVersionRefreshable = doc.version; |
||||
// Switch out old css links for the new css links. Inspired by:
|
||||
// https://github.com/guard/guard-livereload/blob/master/js/livereload.js#L710
|
||||
var newCss = (doc.assets && doc.assets.allCss) || []; |
||||
var oldLinks = []; |
||||
|
||||
Array.prototype.forEach.call( |
||||
document.getElementsByTagName('link'), |
||||
function (link) { |
||||
if (link.className === '__meteor-css__') { |
||||
oldLinks.push(link); |
||||
} |
||||
} |
||||
); |
||||
|
||||
function waitUntilCssLoads(link, callback) { |
||||
var called; |
||||
function executeCallback(...args) { |
||||
if (! called) { |
||||
called = true; |
||||
return callback(...args); |
||||
} |
||||
} |
||||
|
||||
link.onload = function () { |
||||
knownToSupportCssOnLoad = true; |
||||
executeCallback(); |
||||
}; |
||||
|
||||
if (! knownToSupportCssOnLoad) { |
||||
var id = Meteor.setInterval(function () { |
||||
if (link.sheet) { |
||||
executeCallback(); |
||||
Meteor.clearInterval(id); |
||||
} |
||||
}, 50); |
||||
} |
||||
} |
||||
|
||||
var removeOldLinks = after(newCss.length, function () { |
||||
oldLinks.forEach(function (link) { |
||||
link.parentNode.removeChild(link); |
||||
}); |
||||
}); |
||||
|
||||
var attachStylesheetLink = function (newLink) { |
||||
document.getElementsByTagName("head").item(0).appendChild(newLink); |
||||
|
||||
waitUntilCssLoads(newLink, function () { |
||||
Meteor.setTimeout(removeOldLinks, 200); |
||||
}); |
||||
}; |
||||
|
||||
if (newCss.length !== 0) { |
||||
newCss.forEach(function (css) { |
||||
var newLink = document.createElement("link"); |
||||
newLink.setAttribute("rel", "stylesheet"); |
||||
newLink.setAttribute("type", "text/css"); |
||||
newLink.setAttribute("class", "__meteor-css__"); |
||||
newLink.setAttribute("href", css.url); |
||||
attachStylesheetLink(newLink); |
||||
}); |
||||
} else { |
||||
removeOldLinks(); |
||||
} |
||||
|
||||
} |
||||
else if (doc._id === 'version' && doc.version !== autoupdateVersion) { |
||||
handle && handle.stop(); |
||||
|
||||
if (Package.reload) { |
||||
Package.reload.Reload._reload(); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
var handle = ClientVersions.find().observe({ |
||||
added: checkNewVersionDocument, |
||||
changed: checkNewVersionDocument |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
}; |
||||
Autoupdate._retrySubscription(); |
||||
@ -1,85 +0,0 @@ |
||||
var DEBUG_TAG = 'METEOR CORDOVA DEBUG (autoupdate_cordova.js) '; |
||||
var log = function (msg) { |
||||
console.log(DEBUG_TAG + msg); |
||||
}; |
||||
// This constant was picked by testing on iOS 7.1
|
||||
// We limit the number of concurrent downloads because iOS gets angry on the
|
||||
// application when a certain limit is exceeded and starts timing-out the
|
||||
// connections in 1-2 minutes which makes the whole HCP really slow.
|
||||
var MAX_NUM_CONCURRENT_DOWNLOADS = 30; |
||||
var MAX_RETRY_COUNT = 5; |
||||
var autoupdateVersionCordova = __meteor_runtime_config__.autoupdateVersionCordova || "unknown"; |
||||
|
||||
// The collection of acceptable client versions.
|
||||
ClientVersions = new Mongo.Collection("meteor_autoupdate_clientVersions"); |
||||
|
||||
Autoupdate = {}; |
||||
|
||||
Autoupdate.newClientAvailable = function () { |
||||
return !! ClientVersions.findOne({ |
||||
_id: 'version-cordova', |
||||
version: {$ne: autoupdateVersionCordova} |
||||
}); |
||||
}; |
||||
|
||||
var hasCalledReload = false; |
||||
var updating = false; |
||||
var localPathPrefix = null; |
||||
var retry = new Retry({ |
||||
// Unlike the stream reconnect use of Retry, which we want to be instant
|
||||
// in normal operation, this is a wacky failure. We don't want to retry
|
||||
// right away, we can start slowly.
|
||||
//
|
||||
// A better way than timeconstants here might be to use the knowledge
|
||||
// of when we reconnect to help trigger these retries. Typically, the
|
||||
// server fixing code will result in a restart and reconnect, but
|
||||
// potentially the subscription could have a transient error.
|
||||
minCount: 0, // don't do any immediate retries
|
||||
baseTimeout: 30*1000 // start with 30s
|
||||
}); |
||||
var failures = 0; |
||||
|
||||
Autoupdate._retrySubscription = function () { |
||||
var appId = __meteor_runtime_config__.appId; |
||||
Meteor.subscribe("meteor_autoupdate_clientVersions", appId, { |
||||
onError: function (err) { |
||||
Meteor._debug("autoupdate subscription failed:", err); |
||||
failures++; |
||||
retry.retryLater(failures, function () { |
||||
// Just retry making the subscription, don't reload the whole
|
||||
// page. While reloading would catch more cases (for example,
|
||||
// the server went back a version and is now doing old-style hot
|
||||
// code push), it would also be more prone to reload loops,
|
||||
// which look really bad to the user. Just retrying the
|
||||
// subscription over DDP means it is at least possible to fix by
|
||||
// updating the server.
|
||||
Autoupdate._retrySubscription(); |
||||
}); |
||||
} |
||||
}); |
||||
if (Package.reload) { |
||||
var checkNewVersionDocument = function (doc) { |
||||
var self = this; |
||||
if (doc.version !== autoupdateVersionCordova) { |
||||
window.fireGlobalEvent('onNewVersion', doc.version) |
||||
// onNewVersion();
|
||||
} |
||||
}; |
||||
|
||||
var handle = ClientVersions.find({ |
||||
_id: 'version-cordova' |
||||
}).observe({ |
||||
added: checkNewVersionDocument, |
||||
changed: checkNewVersionDocument |
||||
}); |
||||
} |
||||
}; |
||||
|
||||
Meteor.startup(Autoupdate._retrySubscription); |
||||
|
||||
|
||||
window.WebAppLocalServer = {}; |
||||
WebAppLocalServer.startupDidComplete = function() {}; |
||||
WebAppLocalServer.checkForUpdates = function() {}; |
||||
WebAppLocalServer.onNewVersionReady = function() {}; |
||||
WebAppLocalServer.onError = function() {}; |
||||
@ -1,198 +0,0 @@ |
||||
// Publish the current client versions to the client. When a client
|
||||
// sees the subscription change and that there is a new version of the
|
||||
// client available on the server, it can reload.
|
||||
//
|
||||
// By default there are two current client versions. The refreshable client
|
||||
// version is identified by a hash of the client resources seen by the browser
|
||||
// that are refreshable, such as CSS, while the non refreshable client version
|
||||
// is identified by a hash of the rest of the client assets
|
||||
// (the HTML, code, and static files in the `public` directory).
|
||||
//
|
||||
// If the environment variable `AUTOUPDATE_VERSION` is set it will be
|
||||
// used as the client id instead. You can use this to control when
|
||||
// the client reloads. For example, if you want to only force a
|
||||
// reload on major changes, you can use a custom AUTOUPDATE_VERSION
|
||||
// which you only change when something worth pushing to clients
|
||||
// immediately happens.
|
||||
//
|
||||
// The server publishes a `meteor_autoupdate_clientVersions`
|
||||
// collection. There are two documents in this collection, a document
|
||||
// with _id 'version' which represents the non refreshable client assets,
|
||||
// and a document with _id 'version-refreshable' which represents the
|
||||
// refreshable client assets. Each document has a 'version' field
|
||||
// which is equivalent to the hash of the relevant assets. The refreshable
|
||||
// document also contains a list of the refreshable assets, so that the client
|
||||
// can swap in the new assets without forcing a page refresh. Clients can
|
||||
// observe changes on these documents to detect when there is a new
|
||||
// version available.
|
||||
//
|
||||
// In this implementation only two documents are present in the collection
|
||||
// the current refreshable client version and the current nonRefreshable client
|
||||
// version. Developers can easily experiment with different versioning and
|
||||
// updating models by forking this package.
|
||||
|
||||
import Future from "fibers/future"; |
||||
|
||||
Autoupdate = {}; |
||||
|
||||
// The collection of acceptable client versions.
|
||||
ClientVersions = new Mongo.Collection("meteor_autoupdate_clientVersions", |
||||
{ connection: null }); |
||||
|
||||
// The client hash includes __meteor_runtime_config__, so wait until
|
||||
// all packages have loaded and have had a chance to populate the
|
||||
// runtime config before using the client hash as our default auto
|
||||
// update version id.
|
||||
|
||||
// Note: Tests allow people to override Autoupdate.autoupdateVersion before
|
||||
// startup.
|
||||
Autoupdate.autoupdateVersion = null; |
||||
Autoupdate.autoupdateVersionRefreshable = null; |
||||
Autoupdate.autoupdateVersionCordova = null; |
||||
Autoupdate.appId = __meteor_runtime_config__.appId = process.env.APP_ID; |
||||
|
||||
var syncQueue = new Meteor._SynchronousQueue(); |
||||
|
||||
// updateVersions can only be called after the server has fully loaded.
|
||||
var updateVersions = function (shouldReloadClientProgram) { |
||||
// Step 1: load the current client program on the server and update the
|
||||
// hash values in __meteor_runtime_config__.
|
||||
if (shouldReloadClientProgram) { |
||||
WebAppInternals.reloadClientPrograms(); |
||||
} |
||||
|
||||
// If we just re-read the client program, or if we don't have an autoupdate
|
||||
// version, calculate it.
|
||||
if (shouldReloadClientProgram || Autoupdate.autoupdateVersion === null) { |
||||
Autoupdate.autoupdateVersion = |
||||
process.env.AUTOUPDATE_VERSION || |
||||
WebApp.calculateClientHashNonRefreshable(); |
||||
} |
||||
// If we just recalculated it OR if it was set by (eg) test-in-browser,
|
||||
// ensure it ends up in __meteor_runtime_config__.
|
||||
__meteor_runtime_config__.autoupdateVersion = |
||||
Autoupdate.autoupdateVersion; |
||||
|
||||
Autoupdate.autoupdateVersionRefreshable = |
||||
__meteor_runtime_config__.autoupdateVersionRefreshable = |
||||
process.env.AUTOUPDATE_VERSION || |
||||
WebApp.calculateClientHashRefreshable(); |
||||
|
||||
Autoupdate.autoupdateVersionCordova = |
||||
__meteor_runtime_config__.autoupdateVersionCordova = |
||||
process.env.AUTOUPDATE_VERSION || |
||||
WebApp.calculateClientHashCordova(); |
||||
|
||||
// Step 2: form the new client boilerplate which contains the updated
|
||||
// assets and __meteor_runtime_config__.
|
||||
if (shouldReloadClientProgram) { |
||||
WebAppInternals.generateBoilerplate(); |
||||
} |
||||
|
||||
// XXX COMPAT WITH 0.8.3
|
||||
if (! ClientVersions.findOne({current: true})) { |
||||
// To ensure apps with version of Meteor prior to 0.9.0 (in
|
||||
// which the structure of documents in `ClientVersions` was
|
||||
// different) also reload.
|
||||
ClientVersions.insert({current: true}); |
||||
} |
||||
|
||||
if (! ClientVersions.findOne({_id: "version"})) { |
||||
ClientVersions.insert({ |
||||
_id: "version", |
||||
version: Autoupdate.autoupdateVersion |
||||
}); |
||||
} else { |
||||
ClientVersions.update("version", { $set: { |
||||
version: Autoupdate.autoupdateVersion |
||||
}}); |
||||
} |
||||
|
||||
if (! ClientVersions.findOne({_id: "version-cordova"})) { |
||||
ClientVersions.insert({ |
||||
_id: "version-cordova", |
||||
version: Autoupdate.autoupdateVersionCordova, |
||||
refreshable: false |
||||
}); |
||||
} else { |
||||
ClientVersions.update("version-cordova", { $set: { |
||||
version: Autoupdate.autoupdateVersionCordova |
||||
}}); |
||||
} |
||||
|
||||
// Use `onListening` here because we need to use
|
||||
// `WebAppInternals.refreshableAssets`, which is only set after
|
||||
// `WebApp.generateBoilerplate` is called by `main` in webapp.
|
||||
WebApp.onListening(function () { |
||||
if (! ClientVersions.findOne({_id: "version-refreshable"})) { |
||||
ClientVersions.insert({ |
||||
_id: "version-refreshable", |
||||
version: Autoupdate.autoupdateVersionRefreshable, |
||||
assets: WebAppInternals.refreshableAssets |
||||
}); |
||||
} else { |
||||
ClientVersions.update("version-refreshable", { $set: { |
||||
version: Autoupdate.autoupdateVersionRefreshable, |
||||
assets: WebAppInternals.refreshableAssets |
||||
}}); |
||||
} |
||||
}); |
||||
}; |
||||
|
||||
Meteor.publish( |
||||
"meteor_autoupdate_clientVersions", |
||||
function (appId) { |
||||
// `null` happens when a client doesn't have an appId and passes
|
||||
// `undefined` to `Meteor.subscribe`. `undefined` is translated to
|
||||
// `null` as JSON doesn't have `undefined.
|
||||
check(appId, Match.OneOf(String, undefined, null)); |
||||
|
||||
// Don't notify clients using wrong appId such as mobile apps built with a
|
||||
// different server but pointing at the same local url
|
||||
if (Autoupdate.appId && appId && Autoupdate.appId !== appId) |
||||
return []; |
||||
|
||||
return ClientVersions.find(); |
||||
}, |
||||
{is_auto: true} |
||||
); |
||||
|
||||
Meteor.startup(function () { |
||||
updateVersions(false); |
||||
}); |
||||
|
||||
var fut = new Future(); |
||||
|
||||
// We only want 'refresh' to trigger 'updateVersions' AFTER onListen,
|
||||
// so we add a queued task that waits for onListen before 'refresh' can queue
|
||||
// tasks. Note that the `onListening` callbacks do not fire until after
|
||||
// Meteor.startup, so there is no concern that the 'updateVersions' calls from
|
||||
// 'refresh' will overlap with the `updateVersions` call from Meteor.startup.
|
||||
|
||||
syncQueue.queueTask(function () { |
||||
fut.wait(); |
||||
}); |
||||
|
||||
WebApp.onListening(function () { |
||||
fut.return(); |
||||
}); |
||||
|
||||
var enqueueVersionsRefresh = function () { |
||||
syncQueue.queueTask(function () { |
||||
updateVersions(true); |
||||
}); |
||||
}; |
||||
|
||||
// Listen for the special {refresh: 'client'} message, which signals that a
|
||||
// client asset has changed.
|
||||
process.on('message', Meteor.bindEnvironment(function (m) { |
||||
if (m && m.refresh === 'client') { |
||||
enqueueVersionsRefresh(); |
||||
} |
||||
}, "handling client refresh message")); |
||||
|
||||
// Another way to tell the process to refresh: send SIGHUP signal
|
||||
process.on('SIGHUP', Meteor.bindEnvironment(function () { |
||||
enqueueVersionsRefresh(); |
||||
}, "handling SIGHUP signal for refresh")); |
||||
|
||||
@ -1,30 +0,0 @@ |
||||
Package.describe({ |
||||
summary: "Update the client when new client code is available", |
||||
version: '1.4.0' |
||||
}); |
||||
|
||||
Package.onUse(function (api) { |
||||
api.use([ |
||||
'webapp', |
||||
'check' |
||||
], 'server'); |
||||
|
||||
api.use([ |
||||
'tracker', |
||||
'retry' |
||||
], 'client'); |
||||
|
||||
api.use([ |
||||
'ecmascript', |
||||
'ddp', |
||||
'mongo' |
||||
], ['client', 'server']); |
||||
|
||||
api.use(['http', 'random'], 'web.cordova'); |
||||
|
||||
api.addFiles('autoupdate_server.js', 'server'); |
||||
api.addFiles('autoupdate_client.js', 'web.browser'); |
||||
api.addFiles('autoupdate_cordova.js', 'web.cordova'); |
||||
|
||||
api.export('Autoupdate'); |
||||
}); |
||||
@ -1 +1 @@ |
||||
METEOR@1.6.1.3 |
||||
METEOR@1.8 |
||||
|
||||
@ -1,97 +1,99 @@ |
||||
accounts-base@1.4.2 |
||||
accounts-base@1.4.3 |
||||
accounts-password@1.5.1 |
||||
aldeed:simple-schema@1.5.4 |
||||
allow-deny@1.1.0 |
||||
babel-compiler@7.0.9 |
||||
babel-runtime@1.2.2 |
||||
babel-compiler@7.2.1 |
||||
babel-runtime@1.3.0 |
||||
base64@1.0.11 |
||||
binary-heap@1.0.10 |
||||
blaze@2.3.2 |
||||
binary-heap@1.0.11 |
||||
blaze@2.3.3 |
||||
blaze-tools@1.0.10 |
||||
boilerplate-generator@1.4.0 |
||||
caching-compiler@1.1.12 |
||||
caching-html-compiler@1.1.2 |
||||
boilerplate-generator@1.6.0 |
||||
caching-compiler@1.2.0 |
||||
caching-html-compiler@1.1.3 |
||||
callback-hook@1.1.0 |
||||
cfs:http-methods@0.0.32 |
||||
check@1.3.1 |
||||
coffeescript@1.0.17 |
||||
ddp@1.4.0 |
||||
ddp-client@2.3.2 |
||||
ddp-client@2.3.3 |
||||
ddp-common@1.4.0 |
||||
ddp-rate-limiter@1.0.7 |
||||
ddp-server@2.1.2 |
||||
ddp-server@2.2.0 |
||||
deps@1.0.12 |
||||
diff-sequence@1.1.0 |
||||
dynamic-import@0.3.0 |
||||
ecmascript@0.10.9 |
||||
ecmascript-runtime@0.5.0 |
||||
ecmascript-runtime-client@0.6.2 |
||||
ecmascript-runtime-server@0.5.0 |
||||
dynamic-import@0.5.0 |
||||
ecmascript@0.12.1 |
||||
ecmascript-runtime@0.7.0 |
||||
ecmascript-runtime-client@0.8.0 |
||||
ecmascript-runtime-server@0.7.1 |
||||
ejson@1.1.0 |
||||
email@1.2.3 |
||||
es5-shim@4.7.3 |
||||
es5-shim@4.8.0 |
||||
fetch@0.1.0 |
||||
geojson-utils@1.0.10 |
||||
html-tools@1.0.11 |
||||
htmljs@1.0.11 |
||||
http@1.4.1 |
||||
id-map@1.1.0 |
||||
inter-process-messaging@0.1.0 |
||||
jquery@1.11.11 |
||||
kadira:blaze-layout@2.3.0 |
||||
kadira:flow-router@2.12.1 |
||||
konecty:nrr@2.0.2 |
||||
konecty:user-presence@2.1.0 |
||||
less@2.7.12 |
||||
konecty:user-presence@2.2.0 |
||||
less@2.8.0 |
||||
livedata@1.0.18 |
||||
localstorage@1.2.0 |
||||
logging@1.1.20 |
||||
mdg:validation-error@0.5.1 |
||||
meteor@1.8.6 |
||||
meteor@1.9.2 |
||||
meteorspark:util@0.2.0 |
||||
minifier-css@1.3.1 |
||||
minifier-js@2.3.5 |
||||
minimongo@1.4.4 |
||||
minifier-css@1.4.0 |
||||
minifier-js@2.4.0 |
||||
minimongo@1.4.5 |
||||
mizzao:timesync@0.5.0 |
||||
modules@0.11.8 |
||||
modules-runtime@0.9.2 |
||||
modern-browsers@0.1.2 |
||||
modules@0.13.0 |
||||
modules-runtime@0.10.3 |
||||
momentjs:moment@2.22.2 |
||||
mongo@1.4.7 |
||||
mongo@1.6.0 |
||||
mongo-decimal@0.1.0 |
||||
mongo-dev-server@1.1.0 |
||||
mongo-id@1.0.7 |
||||
nooitaf:colors@1.1.2_1 |
||||
npm-bcrypt@0.9.3 |
||||
npm-mongo@2.2.34 |
||||
npm-mongo@3.1.1 |
||||
observe-sequence@1.0.16 |
||||
ordered-dict@1.1.0 |
||||
promise@0.10.2 |
||||
promise@0.11.1 |
||||
raix:eventemitter@0.1.3 |
||||
random@1.1.0 |
||||
rate-limit@1.0.9 |
||||
reactive-dict@1.2.0 |
||||
reactive-dict@1.2.1 |
||||
reactive-var@1.0.11 |
||||
reload@1.2.0 |
||||
retry@1.1.0 |
||||
rocketchat:streamer@0.6.2 |
||||
routepolicy@1.0.13 |
||||
server-render@0.3.1 |
||||
rocketchat:streamer@1.0.1 |
||||
routepolicy@1.1.0 |
||||
service-configuration@1.0.11 |
||||
session@1.1.7 |
||||
session@1.1.8 |
||||
sha@1.0.9 |
||||
shell-server@0.3.1 |
||||
shim-common@0.1.0 |
||||
socket-stream-client@0.1.0 |
||||
shell-server@0.4.0 |
||||
socket-stream-client@0.2.2 |
||||
spacebars@1.0.15 |
||||
spacebars-compiler@1.1.3 |
||||
srp@1.0.10 |
||||
standard-minifier-css@1.4.1 |
||||
standard-minifier-js@2.3.4 |
||||
srp@1.0.12 |
||||
standard-minifier-css@1.5.1 |
||||
standard-minifier-js@2.4.0 |
||||
tap:i18n@1.8.2 |
||||
templating@1.3.2 |
||||
templating-compiler@1.3.3 |
||||
templating-runtime@1.3.2 |
||||
templating-tools@1.1.2 |
||||
tracker@1.1.3 |
||||
tracker@1.2.0 |
||||
ui@1.0.13 |
||||
underscore@1.0.10 |
||||
url@1.2.0 |
||||
webapp@1.5.0 |
||||
webapp@1.7.0 |
||||
webapp-hashing@1.0.9 |
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@ |
||||
node_modules |
||||
@ -1,7 +0,0 @@ |
||||
This directory and the files immediately inside it are automatically generated |
||||
when you change this package's NPM dependencies. Commit the files in this |
||||
directory (npm-shrinkwrap.json, .gitignore, and this README) to source control |
||||
so that others run the same versions of sub-dependencies. |
||||
|
||||
You should NOT check in the node_modules directory that Meteor automatically |
||||
creates; if you are using git, the .gitignore file tells git to ignore it. |
||||
@ -1,62 +0,0 @@ |
||||
{ |
||||
"lockfileVersion": 1, |
||||
"dependencies": { |
||||
"ansi-styles": { |
||||
"version": "3.2.0", |
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", |
||||
"integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==" |
||||
}, |
||||
"app-module-path": { |
||||
"version": "2.2.0", |
||||
"resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", |
||||
"integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU=" |
||||
}, |
||||
"chalk": { |
||||
"version": "2.3.0", |
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", |
||||
"integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==" |
||||
}, |
||||
"color-convert": { |
||||
"version": "1.9.1", |
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", |
||||
"integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==" |
||||
}, |
||||
"color-name": { |
||||
"version": "1.1.3", |
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", |
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" |
||||
}, |
||||
"escape-string-regexp": { |
||||
"version": "1.0.5", |
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", |
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" |
||||
}, |
||||
"has-flag": { |
||||
"version": "2.0.0", |
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", |
||||
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" |
||||
}, |
||||
"postcss": { |
||||
"version": "6.0.13", |
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.13.tgz", |
||||
"integrity": "sha512-nHsrD1PPTMSJDfU+osVsLtPkSP9YGeoOz4FDLN4r1DW4N5vqL1J+gACzTQHsfwIiWG/0/nV4yCzjTMo1zD8U1g==", |
||||
"dependencies": { |
||||
"source-map": { |
||||
"version": "0.6.1", |
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", |
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" |
||||
} |
||||
} |
||||
}, |
||||
"source-map": { |
||||
"version": "0.5.6", |
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", |
||||
"integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=" |
||||
}, |
||||
"supports-color": { |
||||
"version": "4.5.0", |
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", |
||||
"integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=" |
||||
} |
||||
} |
||||
} |
||||
@ -1,25 +0,0 @@ |
||||
Package.describe({ |
||||
summary: 'Minifier for Meteor with PostCSS processing', |
||||
version: '1.0.0', |
||||
name: 'rocketchat:postcss', |
||||
}); |
||||
|
||||
Package.registerBuildPlugin({ |
||||
name: 'minifier-postcss', |
||||
use: [ |
||||
'ecmascript', |
||||
'minifier-css', |
||||
], |
||||
npmDependencies: { |
||||
'app-module-path': '2.2.0', |
||||
postcss: '6.0.13', |
||||
'source-map': '0.5.6', |
||||
}, |
||||
sources: [ |
||||
'plugin/minify-css.js', |
||||
], |
||||
}); |
||||
|
||||
Package.onUse(function(api) { |
||||
api.use('isobuild:minifier-plugin'); |
||||
}); |
||||
@ -1,198 +0,0 @@ |
||||
/* global CssTools */ |
||||
|
||||
import appModulePath from 'app-module-path'; |
||||
import Future from 'fibers/future'; |
||||
import fs from 'fs'; |
||||
import path from 'path'; |
||||
import postCSS from 'postcss'; |
||||
import sourcemap from 'source-map'; |
||||
|
||||
appModulePath.addPath(`${ process.cwd() }/node_modules/`); |
||||
|
||||
const postCSSConfigFile = path.resolve(process.cwd(), '.postcssrc'); |
||||
|
||||
const postCSSConfig = JSON.parse(fs.readFileSync(postCSSConfigFile)); |
||||
|
||||
const getPostCSSPlugins = () => { |
||||
const plugins = []; |
||||
if (postCSSConfig.plugins) { |
||||
Object.keys(postCSSConfig.plugins).forEach((pluginName) => { |
||||
const postCSSPlugin = require(pluginName); |
||||
if (postCSSPlugin && postCSSPlugin().postcssPlugin) { |
||||
plugins.push(postCSSPlugin(postCSSConfig.plugins ? postCSSConfig.plugins[pluginName] : {})); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
return plugins; |
||||
}; |
||||
|
||||
const getExcludedPackages = () => { |
||||
if (postCSSConfig.excludedPackages && postCSSConfig.excludedPackages instanceof Array) { |
||||
return postCSSConfig.excludedPackages; |
||||
} |
||||
|
||||
return false; |
||||
}; |
||||
|
||||
const isNotInExcludedPackages = (excludedPackages, pathInBundle) => { |
||||
let exclArr = []; |
||||
if (excludedPackages && excludedPackages instanceof Array) { |
||||
exclArr = excludedPackages.map((packageName) => pathInBundle && pathInBundle.indexOf(`packages/${ packageName.replace(':', '_') }`) > -1); |
||||
} |
||||
|
||||
return exclArr.indexOf(true) === -1; |
||||
}; |
||||
|
||||
const isNotImport = (inputFileUrl) => !(/\.import\.css$/.test(inputFileUrl) || /(?:^|\/)imports\//.test(inputFileUrl)); |
||||
|
||||
const mergeCss = (css) => { |
||||
const originals = {}; |
||||
const excludedPackagesArr = getExcludedPackages(); |
||||
|
||||
const cssAsts = css.map((file) => { |
||||
const filename = file.getPathInBundle(); |
||||
originals[filename] = file; |
||||
|
||||
const f = new Future; |
||||
|
||||
let css; |
||||
let postres; |
||||
const isFileForPostCSS = isNotInExcludedPackages(excludedPackagesArr, file.getPathInBundle()); |
||||
postCSS(isFileForPostCSS ? getPostCSSPlugins() : []) |
||||
.process(file.getContentsAsString(), { |
||||
from: process.cwd() + file._source.url.replace('_', '-'), |
||||
}) |
||||
.then((result) => { |
||||
result.warnings().forEach((warn) => { |
||||
process.stderr.write(warn.toString()); |
||||
}); |
||||
f.return(result); |
||||
}) |
||||
.catch((error) => { |
||||
if (error.name === 'CssSyntaxError') { |
||||
error.message = `${ error.message }\n\nCss Syntax Error.\n\n${ error.message }${ error.showSourceCode() }`; |
||||
} |
||||
f.return(error); |
||||
}); |
||||
|
||||
try { |
||||
const parseOptions = { |
||||
source: filename, |
||||
position: true, |
||||
}; |
||||
|
||||
postres = f.wait(); |
||||
|
||||
if (postres.name === 'CssSyntaxError') { |
||||
throw postres; |
||||
} |
||||
|
||||
css = postres.css; |
||||
|
||||
const ast = CssTools.parseCss(css, parseOptions); |
||||
ast.filename = filename; |
||||
|
||||
return ast; |
||||
} catch (e) { |
||||
if (e.name === 'CssSyntaxError') { |
||||
file.error({ |
||||
message: e.message, |
||||
line: e.line, |
||||
column: e.column, |
||||
}); |
||||
} else if (e.reason) { |
||||
file.error({ |
||||
message: e.reason, |
||||
line: e.line, |
||||
column: e.column, |
||||
}); |
||||
} else { |
||||
file.error({ |
||||
message: e.message, |
||||
}); |
||||
} |
||||
|
||||
return { |
||||
type: 'stylesheet', |
||||
stylesheet: { rules: [] }, |
||||
filename, |
||||
}; |
||||
} |
||||
}); |
||||
const mergedCssAst = CssTools.mergeCssAsts(cssAsts, (filename, msg) => { |
||||
console.log(`${ filename }: warn: ${ msg }`); |
||||
}); |
||||
|
||||
const stringifiedCss = CssTools.stringifyCss(mergedCssAst, { |
||||
sourcemap: true, |
||||
inputSourcemaps: false, |
||||
}); |
||||
|
||||
if (!stringifiedCss.code) { |
||||
return { code: '' }; |
||||
} |
||||
|
||||
stringifiedCss.map.sourcesContent = |
||||
stringifiedCss.map.sources.map((filename) => originals[filename].getContentsAsString()); |
||||
|
||||
const newMap = sourcemap.SourceMapGenerator.fromSourceMap(new sourcemap.SourceMapConsumer(stringifiedCss.map)); |
||||
|
||||
Object.keys(originals).forEach((name) => { |
||||
const file = originals[name]; |
||||
if (!file.getSourceMap()) { |
||||
return false; |
||||
} |
||||
try { |
||||
newMap.applySourceMap(new sourcemap.SourceMapConsumer(file.getSourceMap()), name); |
||||
} catch (err) { |
||||
// If can't apply the source map, silently drop it.
|
||||
} |
||||
}); |
||||
|
||||
return { |
||||
code: stringifiedCss.code, |
||||
sourceMap: newMap.toString(), |
||||
}; |
||||
}; |
||||
|
||||
class CssToolsMinifier { |
||||
processFilesForBundle(files, options) { |
||||
const mode = options.minifyMode; |
||||
|
||||
if (!files.length) { |
||||
return false; |
||||
} |
||||
|
||||
const filesToMerge = []; |
||||
|
||||
files.forEach((file) => { |
||||
if (isNotImport(file._source.url)) { |
||||
filesToMerge.push(file); |
||||
} |
||||
}); |
||||
|
||||
const merged = mergeCss(filesToMerge); |
||||
|
||||
if (mode === 'development') { |
||||
files[0].addStylesheet({ |
||||
data: merged.code, |
||||
sourceMap: merged.sourceMap, |
||||
path: 'merged-stylesheets.css', |
||||
}); |
||||
return false; |
||||
} |
||||
|
||||
const minifiedFiles = CssTools.minifyCss(merged.code); |
||||
|
||||
if (files.length) { |
||||
minifiedFiles.forEach((minified) => { |
||||
files[0].addStylesheet({ |
||||
data: minified, |
||||
}); |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
|
||||
Plugin.registerMinifier({ extensions: ['css'] }, () => new CssToolsMinifier); |
||||
|
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 226 KiB |
Loading…
Reference in new issue