Skip to content

Commit

Permalink
Merge pull request #734 from sethkinast/master
Browse files Browse the repository at this point in the history
Bump deps
  • Loading branch information
sethkinast committed Jun 3, 2016
2 parents 3fc12ef + a671ebd commit 487da8d
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 6,276 deletions.
17 changes: 14 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
language: node_js
node_js:
- "0.12"
- "iojs"
- "5"
- "6"
matrix:
include:
- node_js: "0.10"
env: TEST="all"
env:
- TEST="all"
- CXX=g++-4.8
notifications:
email:
- [email protected]
- [email protected]
before_install:
- npm install -g npm@2
- npm install -g npm@3
before_script:
- npm update
sudo: false
cache:
directories:
- node_modules
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ module.exports = function(grunt) {
outfile: 'index.html',
display: 'short',
specs: ['test/templates/all.js', 'test/helpers/template.helper.js', 'test/templates.spec.js'],
vendor: ['node_modules/ayepromise/ayepromise.js', 'test/lib/highland.js', 'test/lib/jsreporter.js']
vendor: ['node_modules/ayepromise/ayepromise.js', 'node_modules/highland/dist/highland.js', 'test/lib/jsreporter.js']
},
/*tests production (minified) code*/
testProd: {
Expand Down
39 changes: 16 additions & 23 deletions examples/streaming-incremental/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ dust.onLoad = function(tmpl, cb) {
var app = express();

var position;
var context = {
wait: function(chunk, context, bodies, params) {
var delayMilliseconds = parseInt(params.delay, 10) * 1000;
// Returning a Promise-- Dust will wait for the promise to resolve
var promise = q(position++).delay(delayMilliseconds);
promise.then(function(position) {
console.log('Rendering', params.name, 'which started in position', position);
});
return promise;
}
};

app.get('/', function (req, res) {
dust.render('index', {}, function(err, out) {
Expand All @@ -22,40 +33,22 @@ app.get('/', function (req, res) {

app.use(function(req, res, next) {
console.log('\n\nBeginning the render of', req.path);
console.log('Read hello.dust to see the block names and the order in which they appear.');
position = 1;
next();
});

app.get('/streaming', function(req, res) {
position = 1;
dust.stream('hello', {
'wait': function(chunk, context, bodies, params) {
var delayMilliseconds = parseInt(params.delay, 10) * 1000;
// Returning a Promise-- Dust will wait for the promise to resolve
return q(position++).delay(delayMilliseconds)
.then(function(position) {
console.log('Rendering', params.name, 'which started in position', position);
});
}
}).pipe(res)
dust.stream('hello', context).pipe(res)
.on('end', function() {
console.log('Done!');
});
});

app.get('/rendering', function(req, res) {
position = 1;
dust.render('hello', {
'wait': function(chunk, context, bodies, params) {
var delayMilliseconds = parseInt(params.delay, 10) * 1000;
// Returning a Promise-- Dust will wait for the promise to resolve
return q(position++).delay(delayMilliseconds)
.then(function(position) {
console.log('Rendering', params.name, 'which started in position', position);
});
}
}, function(err, out) {
console.log('Done!');
dust.render('hello', context, function(err, out) {
res.send(out);
console.log('Done!');
});
});

Expand Down
17 changes: 10 additions & 7 deletions examples/streaming-incremental/views/hello.dust
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{#wait name="one" delay=1}
<p>Hello world! I'm delayed one second.
<p>Hello world! I'm delayed one second.</p>
{/wait}

{#wait name="two" delay=2}
Expand All @@ -10,16 +10,19 @@
<p>This block has a longer delay (5 seconds), so the blocks that finish below it will all be flushed as soon as it's ready.</p>
{/wait}

<p>
{#wait name="fourA" delay=1}1{/wait}
{#wait name="fourB" delay=1}2{/wait}
{#wait name="fourC" delay=1}3{/wait}
</p>
<ul>
{#wait name="fourA" delay=1}<li>1</li>{/wait}
{#wait name="fourB" delay=1}<li>2</li>{/wait}
{#wait name="fourC" delay=1}<li>3</li>{/wait}
</ul>

{#wait name="five" delay=10}
<p>This one takes a long time to render, but it's at the bottom of the page so you get the rest of the page first.</p>
{/wait}

{#wait name="six" delay=0}
<p>This block had no delay, but it couldn't be sent to the browser until everything above it completed.</p>
<blockquote>
<p>This block had no delay, so it was rendered first (check the console).
<p>However, it couldn't be sent to the browser until everything above it completed.</p>
</blockquote>
{/wait}
7 changes: 3 additions & 4 deletions lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
var compiler = {},
isArray = dust.isArray;

var escape = (typeof JSON === 'undefined') ?
function(str) { return '"' + escapeToJsSafeString(str) + '"';} :
JSON.stringify;

compiler.compile = function(source, name) {
// the name parameter is optional.
Expand Down Expand Up @@ -430,10 +433,6 @@
.replace(TB, '\\t');
}

var escape = (typeof JSON === 'undefined') ?
function(str) { return '"' + escapeToJsSafeString(str) + '"';} :
JSON.stringify;

function renderSource(source, context, callback) {
var tmpl = dust.loadSource(dust.compile(source));
return loaderFor(tmpl)(context, callback);
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,30 @@
"linkedin"
],
"dependencies": {
"chokidar": "~1.0.1",
"cli": "~0.9.0"
"chokidar": "~1.5.1",
"cli": "~0.11.2"
},
"devDependencies": {
"ayepromise": "~1.1.1",
"grunt": "~0.4.2",
"grunt-bump": "~0.3.1",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "~0.5.1",
"grunt-contrib-connect": "~0.11.2",
"grunt-contrib-copy": "~0.8.0",
"grunt-contrib-jasmine": "~0.9.1",
"grunt-contrib-jshint": "~0.11.1",
"grunt-contrib-uglify": "~0.9.1",
"grunt-contrib-watch": "~0.6.1",
"grunt": "~1.0.1",
"grunt-bump": "~0.8.0",
"grunt-cli": "~1.2.0",
"grunt-contrib-clean": "~1.0.0",
"grunt-contrib-concat": "~1.0.1",
"grunt-contrib-connect": "~1.0.2",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-jasmine": "~1.0.3",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-uglify": "~1.0.1",
"grunt-contrib-watch": "~1.0.0",
"grunt-execute": "~0.2.2",
"grunt-github-changes": "~0.0.6",
"grunt-jasmine-nodejs": "~1.4.0",
"grunt-github-changes": "~0.1.0",
"grunt-jasmine-nodejs": "~1.5.3",
"grunt-peg": "~2.0.0",
"grunt-saucelabs": "~8.6.1",
"grunt-shell": "~1.1.2",
"grunt-template-jasmine-istanbul": "~0.3.3",
"highland": "2.4.0",
"grunt-shell": "~1.3.0",
"grunt-template-jasmine-istanbul": "~0.4.0",
"highland": "2.8.1",
"pegjs": "0.9.0",
"rhino-1_7r3-bin": "~1.0.1",
"rhino-1_7r5-bin": "~1.0.1",
Expand Down
Loading

0 comments on commit 487da8d

Please sign in to comment.