Socket
Socket
Sign inDemoInstall

fastboot

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastboot - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.2

docs/deprecations.md

5

CHANGELOG.md
# FastBoot Changelog
### 1.0.0-beta.2
* Adds support for the "shoebox"‑a place to put data that should be
shared from the server-rendered app to the browser-rendered version.
### 1.0.0-beta.1

@@ -4,0 +9,0 @@

1

index.js

@@ -58,2 +58,3 @@ 'use strict';

* @param {Boolean} [options.resilient] whether to reject the returned promise if there is an error during rendering. Overrides the instance's `resilient` setting
* @param {string} [options.html] the HTML document to insert the rendered app into. Uses the built app's index.html by default.
* @returns {Promise<Result>} result

@@ -60,0 +61,0 @@ */

@@ -5,2 +5,3 @@ 'use strict';

const path = require('path');
const RSVP = require('rsvp');

@@ -192,2 +193,3 @@ const najax = require('najax');

* @param {Object} options
* @param {string} [options.html] the HTML document to insert the rendered app into
* @param {ClientRequest}

@@ -223,2 +225,3 @@ * @returns {Promise<Result>} result

.then(() => waitForApp(instance))
.then(() => createShoebox(doc, fastbootInfo))
.catch(error => result.error = error)

@@ -293,2 +296,30 @@ .then(() => result._finalize())

/*
* Writes the shoebox into the DOM for the browser rendered app to consume.
* Uses a script tag with custom type so that the browser will treat as plain
* text, and not expend effort trying to parse contents of the script tag.
* Each key is written separately so that the browser rendered app can
* parse the specific item at the time it is needed instead of everything
* all at once.
*/
function createShoebox(doc, fastbootInfo) {
let shoebox = fastbootInfo.shoebox;
if (!shoebox) { return RSVP.resolve(); }
for (let key in shoebox) {
if (!shoebox.hasOwnProperty(key)) { continue; }
let value = shoebox[key];
let scriptText = doc.createTextNode(JSON.stringify(value));
let scriptEl = doc.createElement('script');
scriptEl.setAttribute('type', 'fastboot/shoebox');
scriptEl.setAttribute('id', `shoebox-${key}`);
scriptEl.appendChild(scriptText);
doc.body.appendChild(scriptEl);
}
return RSVP.resolve();
}
/*
* Builds a new FastBootInfo instance with the request and response and injects

@@ -295,0 +326,0 @@ * it into the application instance.

6

package.json
{
"name": "fastboot",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.2",
"description": "Library for rendering Ember apps in node.js",
"scripts": {
"test": "mocha"
"test": "mocha",
"preversion": "npm test",
"postversion": "git push origin master --tags"
},

@@ -8,0 +10,0 @@ "repository": {

# FastBoot
[![Build Status](https://travis-ci.org/ember-fastboot/ember-fastboot-server.svg?branch=master)](https://travis-ci.org/ember-fastboot/ember-fastboot-server)
[![Build Status](https://travis-ci.org/ember-fastboot/fastboot.svg?branch=master)](https://travis-ci.org/ember-fastboot/ember-fastboot-server)

@@ -5,0 +5,0 @@ FastBoot is a library for rendering Ember.js applications in Node.js.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc