Skip to content

Releases: donejs/done-ssr

v1.3.2

04 Dec 19:47
Compare
Choose a tag to compare
  • Update uglify-js to the latest version 🚀 #438
  • chore(package): update steal to version 1.6.2 #440
  • Change the can-globals semver range to <2.0.0 #441

1.3.1

22 Nov 19:03
Compare
Choose a tag to compare

This is a patch release fixing a bug with the window object not being the global. This meant if modules that saved state onto the global it wouldn't be available on the window; or vice-versa. Thanks to @nriesco for spotting this issue.

1.3.0

06 Nov 13:40
Compare
Choose a tag to compare

done-ssr 1.3.0 is a major milestone in this project. It represents a refactor of almost the entire codebase while remaining API compatible. The refactor was to enable the new, lower-level, zones API as described before.

Zones API

The new Zones API exposes plugins that can be used with can-zone to handle rendering in a more customizable way. For example, there are 2 DOM implementations to choose from; can-simple-dom (the default used by done-ssr) and can-zone-jsdom.

A few of the zones included are:

  • requests: a Zone that handles rerouting APIs to the local server; /api/todos becomes http://10.0.0.1:8080/api/todos.
  • cookies: Handles copying over cookies from an HTTP Request into the local DOM's document.cookies string.
  • push-images: A Zone that will estable a PUSH Promise when on an HTTP/2 server.

Using the Zones API allows you to do server-rendering in your own HTTP handlers; without using done-ssr to take over a request. An example usage is:

var Zone = require("can-zone");

var requests = require("done-ssr/zones/requests");
var dom = require("can-zone-jsdom")
var pushFetch = require("done-ssr/zones/push-fetch");
var pushImages = require("done-ssr/zones/push-images");
var app = require("./app");

require("spdy").createServer(options, async function(request, response){
	var zone = new Zone([
		// Overrides XHR, fetch
		requests(request),

		// Sets up a DOM
		dom(request),

		pushFetch(response),
		pushImages(response)
	]);

	let {html} = await zone.run(app);

	// The full HTML after all async tasks are complete
	response.end(html);
});

v1.2.0-beta.12

30 Oct 13:27
Compare
Choose a tag to compare

This is the final beta release for the new Zones API of done-ssr.

1.2.0-beta.1

04 Oct 13:04
Compare
Choose a tag to compare

This is the second beta version of done-ssr 1.2.0.

Pull Requests

1.2.0-beta.0

02 Oct 15:00
Compare
Choose a tag to compare

This is a beta release of 1.2.0, which introduces SSR Zones as a public API in done-ssr. It's unknown whether these zones will remain in done-ssr for 1.2.0 or if they are going to be moved to their own repositories, hence why this is a beta release.

For normal done-ssr users nothing has changed, and there's probably no reason to use the beta release. But for those who want a little more control, you can use the new Zones API. You can read about the API here.

This is a typical example of usage:

var Zone = require("can-zone");

var requests = require("done-ssr/zones/requests");
var dom = require("done-ssr/zones/can-simple-dom");
var pushFetch = require("done-ssr/zones/push-fetch");
var pushImages = require("done-ssr/zones/push-images");
var app = require("./app");

require("spdy").createServer(options, function(request, response){
	var zone = new Zone([
		// Overrides XHR, fetch
		requests(request),

		// Sets up a DOM
		dom(request),

		pushFetch(response),
		pushImages(response)
	]);

	zone.run(app).then(function(data){
		// The full HTML after all async tasks are complete
		response.end(data.html);
	});
});

Where app.js looks like:

module.exports = function(){
	// can-zone-jsdom provides a global `document`
	var main = document.createElement("main");
	var ul = document.createElement("ul");
	main.appendChild(ul);

	// This will be PUSHed
	var img = document.createElement("img");
	img.src = "/images/cat.png";
	main.appendChild(img);

	// This will be PUSHed
	fetch("/api/todos").then(res => res.json()).then(todos => {
		todos.forEach(todo => {
			var li = document.createElement("li");
			li.textContent = todo;
			ul.appendChild(li);
		});
	});
};

1.1.5

19 Sep 20:45
Compare
Choose a tag to compare

This is a patch release, removing an unused dependency (npm) that was added by accident.

1.1.4

18 Sep 20:09
Compare
Choose a tag to compare

This is a patch release for #344. The patch switches to using can-global/location/location for setting the internal location object used within canjs.

1.1.3

07 Aug 17:03
Compare
Choose a tag to compare

This is a patch release, fixing an issue with a FOUC upon the first page load when using the incremental rendering strategy.

Pull Requests

1.1.2

02 Aug 17:32
Compare
Choose a tag to compare

This is a bug fix release.

Issues