Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9343 from meteor/jbaxleyiii/streaming-server-render
Improved server rendering, now with stream support.
- Loading branch information
Showing
23 changed files
with
715 additions
and
453 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
packages/boilerplate-generator-tests/.npm/package/npm-shrinkwrap.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 33 additions & 36 deletions
69
packages/boilerplate-generator-tests/web.browser-tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,60 @@ | ||
import { parse, serialize } from 'parse5'; | ||
|
||
import { generateHTMLForArch } from './test-lib'; | ||
import { _ } from 'meteor/underscore'; | ||
|
||
const html = generateHTMLForArch('web.browser'); | ||
Tinytest.addAsync( | ||
"boilerplate-generator-tests - web.browser - basic output", | ||
async function (test) { | ||
const html = await generateHTMLForArch("web.browser"); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.browser - well-formed html", function (test) { | ||
const formatted = serialize(parse(html)); | ||
test.isTrue(formatted.replace(/\s/g, '') === html.replace(/\s/g, '')); | ||
}); | ||
// well-formed html | ||
const formatted = serialize(parse(html)); | ||
test.isTrue(formatted.replace(/\s/g, '') === html.replace(/\s/g, '')); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.browser - include htmlAttributes", function (test) { | ||
test.matches(html, /foo="foobar"/); | ||
}); | ||
// include htmlAttributes | ||
test.matches(html, /foo="foobar"/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.browser - escape htmlAttributes", function (test) { | ||
test.matches(html, /gems="&""/); | ||
}); | ||
// escape htmlAttributes | ||
test.matches(html, /gems="&""/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.browser - include js", function (test) { | ||
test.matches(html, /<script[^<>]*src="[^<>]*templating[^<>]*">/); | ||
}); | ||
// include js | ||
test.matches(html, /<script[^<>]*src="[^<>]*templating[^<>]*">/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.browser - escape js", function (test) { | ||
test.matches(html, /<script[^<>]*src="[^<>]*templating[^<>]*&v="1"[^<>]*">/); | ||
}); | ||
// escape js | ||
test.matches(html, /<script[^<>]*src="[^<>]*templating[^<>]*&v="1"[^<>]*">/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.browser - include css", function (test) { | ||
test.matches(html, /<link[^<>]*href="[^<>]*bootstrap[^<>]*">/); | ||
}); | ||
// include css | ||
test.matches(html, /<link[^<>]*href="[^<>]*bootstrap[^<>]*">/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.browser - escape css", function (test) { | ||
test.matches(html, /<link[^<>]*href="[^<>]*bootstrap[^<>]*&v="1"[^<>]*">/); | ||
}); | ||
// escape css | ||
test.matches(html, /<link[^<>]*href="[^<>]*bootstrap[^<>]*&v="1"[^<>]*">/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.browser - call rewriteHook", function (test) { | ||
test.matches(html, /\+rewritten_url=true/); | ||
}); | ||
// call rewriteHook | ||
test.matches(html, /\+rewritten_url=true/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.browser - include runtime config", function (test) { | ||
test.matches(html, /<script[^<>]*>[^<>]*__meteor_runtime_config__ =.*decodeURIComponent\(config123\)/); | ||
}); | ||
// include runtime config | ||
test.matches(html, /<script[^<>]*>[^<>]*__meteor_runtime_config__ =.*decodeURIComponent\(config123\)/); | ||
} | ||
); | ||
|
||
// https://github.com/meteor/meteor/issues/9149 | ||
Tinytest.add( | ||
Tinytest.addAsync( | ||
"boilerplate-generator-tests - web.browser - properly render boilerplate " + | ||
"elements when _.template settings are overridden", | ||
function (test) { | ||
import { _ } from 'meteor/underscore'; | ||
"elements when _.template settings are overridden", | ||
async function (test) { | ||
const newHtml = await generateHTMLForArch("web.browser"); | ||
|
||
_.templateSettings = { | ||
interpolate: /\{\{(.+?)\}\}/g | ||
}; | ||
const newHtml = generateHTMLForArch('web.browser'); | ||
|
||
test.matches(newHtml, /foo="foobar"/); | ||
test.matches(newHtml, /<link[^<>]*href="[^<>]*bootstrap[^<>]*">/); | ||
test.matches(newHtml, /<script[^<>]*src="[^<>]*templating[^<>]*">/); | ||
test.matches(newHtml, /<script>var a/); | ||
test.matches( | ||
newHtml, | ||
/<script[^<>]*>[^<>]*__meteor_runtime_config__ =.*decodeURIComponent\(config123\)/ | ||
/<script[^<>]*>[^<>]*__meteor_runtime_config__ =.*decodeURIComponent\(config123\)/ | ||
); | ||
} | ||
); |
58 changes: 28 additions & 30 deletions
58
packages/boilerplate-generator-tests/web.cordova-tests.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,52 @@ | ||
import { parse, serialize } from 'parse5'; | ||
|
||
import { generateHTMLForArch } from './test-lib'; | ||
import { _ } from 'meteor/underscore'; | ||
|
||
const html = generateHTMLForArch('web.cordova'); | ||
Tinytest.addAsync( | ||
"boilerplate-generator-tests - web.cordova - basic output", | ||
async function (test) { | ||
const html = await generateHTMLForArch("web.cordova"); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.cordova - well-formed html", function (test) { | ||
const formatted = serialize(parse(html)); | ||
test.isTrue(formatted.replace(/\s/g, '') === html.replace(/\s/g, '')); | ||
}); | ||
// well-formed html | ||
const formatted = serialize(parse(html)); | ||
test.isTrue(formatted.replace(/\s/g, '') === html.replace(/\s/g, '')); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.cordova - include js", function (test) { | ||
test.matches(html, /<script[^<>]*src="[^<>]*templating[^<>]*">/); | ||
}); | ||
// include js | ||
test.matches(html, /<script[^<>]*src="[^<>]*templating[^<>]*">/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.cordova - escape js", function (test) { | ||
test.matches(html, /<script[^<>]*src="[^<>]*templating[^<>]*&v="1"[^<>]*">/); | ||
}); | ||
// escape js | ||
test.matches(html, /<script[^<>]*src="[^<>]*templating[^<>]*&v="1"[^<>]*">/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.cordova - include css", function (test) { | ||
test.matches(html, /<link[^<>]*href="[^<>]*bootstrap[^<>]*">/); | ||
}); | ||
// include css | ||
test.matches(html, /<link[^<>]*href="[^<>]*bootstrap[^<>]*">/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.cordova - escape css", function (test) { | ||
test.matches(html, /<link[^<>]*href="[^<>]*bootstrap[^<>]*&v="1"[^<>]*">/); | ||
}); | ||
// escape css | ||
test.matches(html, /<link[^<>]*href="[^<>]*bootstrap[^<>]*&v="1"[^<>]*">/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.cordova - do not call rewriteHook", function (test) { | ||
test.notMatches(html, /\+rewritten_url=true/); | ||
}); | ||
// do not call rewriteHook | ||
test.notMatches(html, /\+rewritten_url=true/); | ||
|
||
Tinytest.add("boilerplate-generator-tests - web.cordova - include runtime config", function (test) { | ||
test.matches(html, /<script[^<>]*>[^<>]*\n[^<>]*__meteor_runtime_config__ =[^<>]*decodeURIComponent\(config123\)\)/); | ||
}); | ||
// include runtime config | ||
test.matches(html, /<script[^<>]*>[^<>]*\n[^<>]*__meteor_runtime_config__ =[^<>]*decodeURIComponent\(config123\)\)/); | ||
} | ||
); | ||
|
||
// https://github.com/meteor/meteor/issues/9149 | ||
Tinytest.add( | ||
Tinytest.addAsync( | ||
"boilerplate-generator-tests - web.cordova - properly render boilerplate " + | ||
"elements when _.template settings are overridden", | ||
function (test) { | ||
import { _ } from 'meteor/underscore'; | ||
"elements when _.template settings are overridden", | ||
async function (test) { | ||
const newHtml = await generateHTMLForArch('web.cordova'); | ||
|
||
_.templateSettings = { | ||
interpolate: /\{\{(.+?)\}\}/g | ||
}; | ||
const newHtml = generateHTMLForArch('web.cordova'); | ||
test.matches(newHtml, /<link[^<>]*href="[^<>]*bootstrap[^<>]*">/); | ||
test.matches(newHtml, /<script[^<>]*src="[^<>]*templating[^<>]*">/); | ||
test.matches(newHtml, /<script>var a/); | ||
test.matches( | ||
newHtml, | ||
/<script[^<>]*>[^<>]*__meteor_runtime_config__ =.*decodeURIComponent\(config123\)/ | ||
/<script[^<>]*>[^<>]*__meteor_runtime_config__ =.*decodeURIComponent\(config123\)/ | ||
); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
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. |
30 changes: 30 additions & 0 deletions
30
packages/boilerplate-generator/.npm/package/npm-shrinkwrap.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.