Skip to content

Commit

Permalink
chore: updgrade parser and make required changes
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jul 25, 2019
1 parent a7c798c commit d44fb46
Show file tree
Hide file tree
Showing 55 changed files with 381 additions and 356 deletions.
6 changes: 3 additions & 3 deletions fixtures/components-isolated-state/compiled.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function (template, ctx) {
let out = ''
out += template.renderWithState('components-isolated-state/alert', {}, { })
return out
let out = '';
out += template.renderWithState('components-isolated-state/alert', {}, { });
return out;
})(template, ctx)
24 changes: 12 additions & 12 deletions fixtures/components-named-slots/compiled.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
(function (template, ctx) {
let out = ''
let out = '';
out += template.renderWithState('components-named-slots/alert', {}, { 'heading': (function (template, ctx) {
return function () {
let slot_0 = ''
slot_0 += ' This is title'
return slot_0
}
let slot_0 = '';
slot_0 += ' This is title';
return slot_0;
};
})(template, ctx), 'main': (function (template, ctx) {
return function () {
let slot_1 = ''
slot_1 += '\n'
slot_1 += ' This is then body'
return slot_1
}
})(template, ctx) })
return out
let slot_1 = '';
slot_1 += '\n';
slot_1 += ' This is then body';
return slot_1;
};
})(template, ctx) });
return out;
})(template, ctx)
16 changes: 8 additions & 8 deletions fixtures/components-partials/compiled.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(function (template, ctx) {
let out = ''
let out = '';
out += template.renderWithState('components-partials/alert', { username: 'virk' }, { 'main': (function (template, ctx) {
return function () {
let slot_0 = ''
slot_0 += ' Hello '
slot_0 += `${ctx.escape(ctx.resolve('username') || 'Guest')}`
return slot_0
}
})(template, ctx) })
return out
let slot_0 = '';
slot_0 += ' Hello ';
slot_0 += `${ctx.escape(ctx.resolve('username') || 'Guest')}`;
return slot_0;
};
})(template, ctx) });
return out;
})(template, ctx)
14 changes: 7 additions & 7 deletions fixtures/components-props/compiled.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(function (template, ctx) {
let out = ''
let out = '';
out += template.renderWithState('components-props/alert', { 'title': 'H1' }, { 'main': (function (template, ctx) {
return function () {
let slot_0 = ''
slot_0 += 'Hello world'
return slot_0
}
})(template, ctx) })
return out
let slot_0 = '';
slot_0 += 'Hello world';
return slot_0;
};
})(template, ctx) });
return out;
})(template, ctx)
22 changes: 11 additions & 11 deletions fixtures/components-slot-props/compiled.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
(function (template, ctx) {
let out = ''
let out = '';
out += template.renderWithState('components-slot-props/alert', {}, { 'title': (function (template, ctx) {
return function (user) {
let slot_0 = ''
ctx.newFrame()
ctx.setOnFrame('user', user)
slot_0 += ' Hello '
slot_0 += `${ctx.escape(ctx.resolve('user').username)}`
ctx.removeFrame()
return slot_0
}
})(template, ctx) })
return out
let slot_0 = '';
ctx.newFrame();
ctx.setOnFrame('user', user);
slot_0 += ' Hello ';
slot_0 += `${ctx.escape(ctx.resolve('user').username)}`;
ctx.removeFrame();
return slot_0;
};
})(template, ctx) });
return out;
})(template, ctx)
14 changes: 7 additions & 7 deletions fixtures/components-slots-partials/compiled.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(function (template, ctx) {
let out = ''
let out = '';
out += template.renderWithState('components-slots-partials/alert', {}, { 'main': (function (template, ctx) {
return function () {
let slot_0 = ''
slot_0 += template.renderInline('components-slots-partials/partial')(template, ctx)
return slot_0
}
})(template, ctx) })
return out
let slot_0 = '';
slot_0 += template.renderInline('components-slots-partials/partial')(template, ctx);
return slot_0;
};
})(template, ctx) });
return out;
})(template, ctx)
16 changes: 8 additions & 8 deletions fixtures/components-state/compiled.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(function (template, ctx) {
let out = ''
let out = '';
out += template.renderWithState('components-state/alert', {}, { 'main': (function (template, ctx) {
return function () {
let slot_0 = ''
slot_0 += ' Hello '
slot_0 += `${ctx.escape(ctx.resolve('username'))}`
return slot_0
}
})(template, ctx) })
return out
let slot_0 = '';
slot_0 += ' Hello ';
slot_0 += `${ctx.escape(ctx.resolve('username'))}`;
return slot_0;
};
})(template, ctx) });
return out;
})(template, ctx)
14 changes: 7 additions & 7 deletions fixtures/components/compiled.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(function (template, ctx) {
let out = ''
let out = '';
out += template.renderWithState('components/alert', {}, { 'main': (function (template, ctx) {
return function () {
let slot_0 = ''
slot_0 += ' Hello world'
return slot_0
}
})(template, ctx) })
return out
let slot_0 = '';
slot_0 += ' Hello world';
return slot_0;
};
})(template, ctx) });
return out;
})(template, ctx)
10 changes: 5 additions & 5 deletions fixtures/debugger/compiled.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(function (template, ctx) {
let out = ''
let out = '';
debugger;
out += ''
out += '\n'
out += 'Hello'
return out
out += '';
out += '\n';
out += 'Hello';
return out;
})(template, ctx)
44 changes: 22 additions & 22 deletions fixtures/each-loop-set/compiled.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
(function (template, ctx) {
let out = ''
ctx.set('total', 0)
let out = '';
ctx.set('total', 0);
ctx.loop(ctx.resolve('items'), function (item, loop) {
ctx.newFrame()
ctx.setOnFrame('item', item)
ctx.setOnFrame('$loop', loop)
ctx.setOnFrame('key', loop.key)
ctx.set('grossPrice', ctx.resolve('item').price * ctx.resolve('item').quantity)
ctx.set('total', ctx.resolve('total') + ctx.resolve('grossPrice'))
out += ''
out += '\n'
out += '- '
out += `${ctx.escape(ctx.resolve('item').name)}`
out += ' x '
out += `${ctx.escape(ctx.resolve('item').quantity)}`
out += ' = '
out += `${ctx.escape(ctx.resolve('grossPrice'))}`
ctx.removeFrame()
})
out += '\n'
out += 'Total price = '
out += `${ctx.escape(ctx.resolve('total'))}`
return out
ctx.newFrame();
ctx.setOnFrame('item', item);
ctx.setOnFrame('$loop', loop);
ctx.setOnFrame('key', loop.key);
ctx.set('grossPrice', ctx.resolve('item').price * ctx.resolve('item').quantity);
ctx.set('total', ctx.resolve('total') + ctx.resolve('grossPrice'));
out += '';
out += '\n';
out += '- ';
out += `${ctx.escape(ctx.resolve('item').name)}`;
out += ' x ';
out += `${ctx.escape(ctx.resolve('item').quantity)}`;
out += ' = ';
out += `${ctx.escape(ctx.resolve('grossPrice'))}`;
ctx.removeFrame();
});
out += '\n';
out += 'Total price = ';
out += `${ctx.escape(ctx.resolve('total'))}`;
return out;
})(template, ctx)
20 changes: 10 additions & 10 deletions fixtures/each-tag-array/compiled.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
(function (template, ctx) {
let out = ''
let out = '';
ctx.loop([{
username: 'virk'
}], function (user, loop) {
ctx.newFrame()
ctx.setOnFrame('user', user)
ctx.setOnFrame('$loop', loop)
ctx.setOnFrame('key', loop.key)
out += ' - Hello '
out += `${ctx.escape(ctx.resolve('user').username)}`
ctx.removeFrame()
})
return out
ctx.newFrame();
ctx.setOnFrame('user', user);
ctx.setOnFrame('$loop', loop);
ctx.setOnFrame('key', loop.key);
out += ' - Hello ';
out += `${ctx.escape(ctx.resolve('user').username)}`;
ctx.removeFrame();
});
return out;
})(template, ctx)
24 changes: 12 additions & 12 deletions fixtures/each-tag-else/compiled.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
(function (template, ctx) {
let out = ''
let out = '';
if(ctx.size(ctx.resolve('users'))) {
ctx.loop(ctx.resolve('users'), function (user, loop) {
ctx.newFrame()
ctx.setOnFrame('user', user)
ctx.setOnFrame('$loop', loop)
ctx.setOnFrame('key', loop.key)
out += ' - Hello '
out += `${ctx.escape(ctx.resolve('user').username)}`
out += '\n'
ctx.removeFrame()
})
ctx.newFrame();
ctx.setOnFrame('user', user);
ctx.setOnFrame('$loop', loop);
ctx.setOnFrame('key', loop.key);
out += ' - Hello ';
out += `${ctx.escape(ctx.resolve('user').username)}`;
out += '\n';
ctx.removeFrame();
});
} else {
out += ' No users found'
out += ' No users found';
}
return out
return out;
})(template, ctx)
20 changes: 10 additions & 10 deletions fixtures/each-tag-index/compiled.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
(function (template, ctx) {
let out = ''
let out = '';
ctx.loop(ctx.resolve('users'), function (user, loop) {
ctx.newFrame()
ctx.setOnFrame('user', user)
ctx.setOnFrame('$loop', loop)
ctx.setOnFrame('index', loop.key)
out += ' - Hello '
out += `${ctx.escape(ctx.resolve('user').username)}`
ctx.removeFrame()
})
return out
ctx.newFrame();
ctx.setOnFrame('user', user);
ctx.setOnFrame('$loop', loop);
ctx.setOnFrame('index', loop.key);
out += ' - Hello ';
out += `${ctx.escape(ctx.resolve('user').username)}`;
ctx.removeFrame();
});
return out;
})(template, ctx)
20 changes: 10 additions & 10 deletions fixtures/each-tag/compiled.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
(function (template, ctx) {
let out = ''
let out = '';
ctx.loop(ctx.resolve('users'), function (user, loop) {
ctx.newFrame()
ctx.setOnFrame('user', user)
ctx.setOnFrame('$loop', loop)
ctx.setOnFrame('key', loop.key)
out += ' - Hello '
out += `${ctx.escape(ctx.resolve('user').username)}`
ctx.removeFrame()
})
return out
ctx.newFrame();
ctx.setOnFrame('user', user);
ctx.setOnFrame('$loop', loop);
ctx.setOnFrame('key', loop.key);
out += ' - Hello ';
out += `${ctx.escape(ctx.resolve('user').username)}`;
ctx.removeFrame();
});
return out;
})(template, ctx)
16 changes: 8 additions & 8 deletions fixtures/else-if-tag/compiled.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
(function (template, ctx) {
let out = ''
let out = '';
if(ctx.resolve('username') === 'virk') {
out += ' Hello VK'
out += '\n'
out += ' Hello VK';
out += '\n';
} else if(ctx.resolve('username')) {
out += ' Hello '
out += `${ctx.escape(ctx.resolve('username'))}`
out += '\n'
out += ' Hello ';
out += `${ctx.escape(ctx.resolve('username'))}`;
out += '\n';
} else {
out += ' Hello Guest!'
out += ' Hello Guest!';
}
return out
return out;
})(template, ctx)
12 changes: 6 additions & 6 deletions fixtures/else-tag/compiled.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(function (template, ctx) {
let out = ''
let out = '';
if(ctx.resolve('username')) {
out += ' Hello '
out += `${ctx.escape(ctx.resolve('username'))}`
out += '\n'
out += ' Hello ';
out += `${ctx.escape(ctx.resolve('username'))}`;
out += '\n';
} else {
out += ' Hello guest!'
out += ' Hello guest!';
}
return out
return out;
})(template, ctx)
Loading

0 comments on commit d44fb46

Please sign in to comment.