frosty 0.0.159 → 0.0.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -25,11 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
import _ from 'lodash';
|
|
27
27
|
import { ServerDOMRenderer } from 'frosty/server-dom';
|
|
28
|
-
import { JSDOM, CookieJar
|
|
29
|
-
|
|
30
|
-
class NoOpResourceLoader extends ResourceLoader {
|
|
31
|
-
fetch(url, options) { return null; }
|
|
32
|
-
}
|
|
28
|
+
import { JSDOM, CookieJar } from 'jsdom';
|
|
33
29
|
|
|
34
30
|
export const renderToHTML = async (App, {
|
|
35
31
|
request: req,
|
|
@@ -38,15 +34,13 @@ export const renderToHTML = async (App, {
|
|
|
38
34
|
cssSrc,
|
|
39
35
|
}) => {
|
|
40
36
|
const referrer = req.get('Referrer');
|
|
41
|
-
const userAgent = req.get('User-Agent');
|
|
42
37
|
const url = `${req.protocol}://${req.get('host')}${req.originalUrl}`;
|
|
43
38
|
const cookieJar = new CookieJar();
|
|
44
39
|
for (const cookie of _.split(req.get('cookie'), ';')) {
|
|
45
40
|
const trimmedCookie = cookie.trim();
|
|
46
41
|
if (trimmedCookie) cookieJar.setCookieSync(trimmedCookie, url);
|
|
47
42
|
}
|
|
48
|
-
const
|
|
49
|
-
const dom = new JSDOM(undefined, { url, referrer, userAgent, resources: loader, cookieJar });
|
|
43
|
+
const dom = new JSDOM(undefined, { url, referrer, cookieJar });
|
|
50
44
|
const renderer = new ServerDOMRenderer(dom);
|
|
51
45
|
res.setHeader('Content-Type', 'text/html');
|
|
52
46
|
res.send(await renderer.renderToString(
|