Skip to content

Commit

Permalink
feat: add support for content stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Sep 18, 2024
1 parent 7adbb0c commit 5714054
Show file tree
Hide file tree
Showing 138 changed files with 1,320 additions and 14 deletions.
12 changes: 12 additions & 0 deletions async_fixtures/multiple_stacks/compiled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let out = "";
let $lineNumber = 1;
let $filename = "{{__dirname}}index.edge";
try {
out += template.stacks.create('js');
out += "\n";
$lineNumber = 2;
out += template.stacks.create('css');
} catch (error) {
template.reThrow(error, $filename, $lineNumber);
}
return out;
2 changes: 2 additions & 0 deletions async_fixtures/multiple_stacks/index.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@stack('js')
@stack('css')
3 changes: 3 additions & 0 deletions async_fixtures/multiple_stacks/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"username": "virk"
}
Empty file.
18 changes: 18 additions & 0 deletions async_fixtures/push_once_to/compiled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
let out = "";
let $lineNumber = 1;
let $filename = "{{__dirname}}index.edge";
try {
out += template.stacks.create('js');
out += "\n";
$lineNumber = 2;
out += await template.compilePartial('push_once_to/script')(template,state,$context);
out += "\n";
$lineNumber = 3;
out += await template.compilePartial('push_once_to/script')(template,state,$context);
out += "\n";
$lineNumber = 4;
out += await template.compilePartial('push_once_to/script')(template,state,$context);
} catch (error) {
template.reThrow(error, $filename, $lineNumber);
}
return out;
4 changes: 4 additions & 0 deletions async_fixtures/push_once_to/index.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@stack('js')
@include('push_once_to/script')
@include('push_once_to/script')
@include('push_once_to/script')
3 changes: 3 additions & 0 deletions async_fixtures/push_once_to/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"username": "virk"
}
3 changes: 3 additions & 0 deletions async_fixtures/push_once_to/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
var a = require('a')
</script>
5 changes: 5 additions & 0 deletions async_fixtures/push_once_to/script.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@pushOnceTo('js')
<script>
var a = require('a')
</script>
@end
18 changes: 18 additions & 0 deletions async_fixtures/push_once_to_using_variables/compiled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
let out = "";
let $lineNumber = 1;
let $filename = "{{__dirname}}index.edge";
try {
out += template.stacks.create(state.stackName);
out += "\n";
$lineNumber = 2;
out += await template.compilePartial('push_once_to_using_variables/script')(template,state,$context);
out += "\n";
$lineNumber = 3;
out += await template.compilePartial('push_once_to_using_variables/script')(template,state,$context);
out += "\n";
$lineNumber = 4;
out += await template.compilePartial('push_once_to_using_variables/script')(template,state,$context);
} catch (error) {
template.reThrow(error, $filename, $lineNumber);
}
return out;
4 changes: 4 additions & 0 deletions async_fixtures/push_once_to_using_variables/index.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@stack(stackName)
@include('push_once_to_using_variables/script')
@include('push_once_to_using_variables/script')
@include('push_once_to_using_variables/script')
3 changes: 3 additions & 0 deletions async_fixtures/push_once_to_using_variables/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"stackName": "js"
}
3 changes: 3 additions & 0 deletions async_fixtures/push_once_to_using_variables/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
var a = require('a')
</script>
5 changes: 5 additions & 0 deletions async_fixtures/push_once_to_using_variables/script.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@pushOnceTo(stackName)
<script>
var a = require('a')
</script>
@end
18 changes: 18 additions & 0 deletions async_fixtures/push_once_to_via_components/compiled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
let out = "";
let $lineNumber = 1;
let $filename = "{{__dirname}}index.edge";
try {
out += template.stacks.create('js');
out += "\n";
$lineNumber = 2;
out += await template.compileComponent('push_once_to_via_components/script')(template, template.getComponentState({}, { $context: Object.assign({}, $context), main: function () { return "" } }, { filename: $filename, line: $lineNumber, col: 0 }), $context);
out += "\n";
$lineNumber = 3;
out += await template.compileComponent('push_once_to_via_components/script')(template, template.getComponentState({}, { $context: Object.assign({}, $context), main: function () { return "" } }, { filename: $filename, line: $lineNumber, col: 0 }), $context);
out += "\n";
$lineNumber = 4;
out += await template.compileComponent('push_once_to_via_components/script')(template, template.getComponentState({}, { $context: Object.assign({}, $context), main: function () { return "" } }, { filename: $filename, line: $lineNumber, col: 0 }), $context);
} catch (error) {
template.reThrow(error, $filename, $lineNumber);
}
return out;
4 changes: 4 additions & 0 deletions async_fixtures/push_once_to_via_components/index.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@stack('js')
@!component('push_once_to_via_components/script')
@!component('push_once_to_via_components/script')
@!component('push_once_to_via_components/script')
3 changes: 3 additions & 0 deletions async_fixtures/push_once_to_via_components/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"username": "virk"
}
3 changes: 3 additions & 0 deletions async_fixtures/push_once_to_via_components/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
var a = require('a')
</script>
5 changes: 5 additions & 0 deletions async_fixtures/push_once_to_via_components/script.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@pushOnceTo('js')
<script>
var a = require('a')
</script>
@end
19 changes: 19 additions & 0 deletions async_fixtures/push_to/compiled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let out = "";
let $lineNumber = 1;
let $filename = "{{__dirname}}index.edge";
try {
out += template.stacks.create('js');
out += "\n";
out += "";
$lineNumber = 3;
let stack_1 = "";
stack_1 += " \u003Cscript\u003E";
stack_1 += "\n";
stack_1 += " var a = require('a')";
stack_1 += "\n";
stack_1 += " \u003C\u002Fscript\u003E";
template.stacks.pushTo('js', stack_1);
} catch (error) {
template.reThrow(error, $filename, $lineNumber);
}
return out;
7 changes: 7 additions & 0 deletions async_fixtures/push_to/index.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@stack('js')

@pushTo('js')
<script>
var a = require('a')
</script>
@end
3 changes: 3 additions & 0 deletions async_fixtures/push_to/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"username": "virk"
}
3 changes: 3 additions & 0 deletions async_fixtures/push_to/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
var a = require('a')
</script>
25 changes: 25 additions & 0 deletions async_fixtures/push_to_conditionals/compiled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
let out = "";
let $lineNumber = 1;
let $filename = "{{__dirname}}index.edge";
try {
out += template.stacks.create('js');
out += "\n";
out += "";
$lineNumber = 3;
if (true) {
out += "\n";
$lineNumber = 4;
let stack_1 = "";
stack_1 += " \u003Cscript\u003E";
stack_1 += "\n";
stack_1 += " var a = ";
$lineNumber = 6;
stack_1 += `${state.requireFoo}`;
stack_1 += "\n";
stack_1 += " \u003C\u002Fscript\u003E";
template.stacks.pushTo('js', stack_1);
}
} catch (error) {
template.reThrow(error, $filename, $lineNumber);
}
return out;
9 changes: 9 additions & 0 deletions async_fixtures/push_to_conditionals/index.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@stack('js')

@if(true)
@pushTo('js')
<script>
var a = {{{ requireFoo }}}
</script>
@end
@end
4 changes: 4 additions & 0 deletions async_fixtures/push_to_conditionals/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"username": "virk",
"requireFoo": "require('a')"
}
3 changes: 3 additions & 0 deletions async_fixtures/push_to_conditionals/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script>
var a = require('a')
</script>
29 changes: 29 additions & 0 deletions async_fixtures/push_to_multiple_times/compiled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
let out = "";
let $lineNumber = 1;
let $filename = "{{__dirname}}index.edge";
try {
out += template.stacks.create('js');
out += "\n";
out += "";
$lineNumber = 3;
let stack_1 = "";
stack_1 += " \u003Cscript\u003E";
stack_1 += "\n";
stack_1 += " var a = require('a')";
stack_1 += "\n";
stack_1 += " \u003C\u002Fscript\u003E";
template.stacks.pushTo('js', stack_1);
out += "\n";
out += "";
$lineNumber = 9;
let stack_2 = "";
stack_2 += " \u003Cscript\u003E";
stack_2 += "\n";
stack_2 += " var b = require('b')";
stack_2 += "\n";
stack_2 += " \u003C\u002Fscript\u003E";
template.stacks.pushTo('js', stack_2);
} catch (error) {
template.reThrow(error, $filename, $lineNumber);
}
return out;
13 changes: 13 additions & 0 deletions async_fixtures/push_to_multiple_times/index.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@stack('js')

@pushTo('js')
<script>
var a = require('a')
</script>
@end

@pushTo('js')
<script>
var b = require('b')
</script>
@end
3 changes: 3 additions & 0 deletions async_fixtures/push_to_multiple_times/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"username": "virk"
}
6 changes: 6 additions & 0 deletions async_fixtures/push_to_multiple_times/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
var a = require('a')
</script>
<script>
var b = require('b')
</script>
15 changes: 15 additions & 0 deletions async_fixtures/push_to_multiple_via_components/compiled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let out = "";
let $lineNumber = 1;
let $filename = "{{__dirname}}index.edge";
try {
out += template.stacks.create('js');
out += "\n";
$lineNumber = 2;
out += await template.compileComponent('push_to_multiple_via_components/script')(template, template.getComponentState({}, { $context: Object.assign({}, $context), main: function () { return "" } }, { filename: $filename, line: $lineNumber, col: 0 }), $context);
out += "\n";
$lineNumber = 3;
out += await template.compileComponent('push_to_multiple_via_components/script')(template, template.getComponentState({}, { $context: Object.assign({}, $context), main: function () { return "" } }, { filename: $filename, line: $lineNumber, col: 0 }), $context);
} catch (error) {
template.reThrow(error, $filename, $lineNumber);
}
return out;
3 changes: 3 additions & 0 deletions async_fixtures/push_to_multiple_via_components/index.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@stack('js')
@!component('push_to_multiple_via_components/script')
@!component('push_to_multiple_via_components/script')
3 changes: 3 additions & 0 deletions async_fixtures/push_to_multiple_via_components/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"username": "virk"
}
6 changes: 6 additions & 0 deletions async_fixtures/push_to_multiple_via_components/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
var a = require('a')
</script>
<script>
var a = require('a')
</script>
1 change: 1 addition & 0 deletions async_fixtures/push_to_multiple_via_components/script.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@include('push_to_multiple_via_components/script_partial')
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@pushTo('js')
<script>
var a = require('a')
</script>
@end
15 changes: 15 additions & 0 deletions async_fixtures/push_to_multiple_via_paritals/compiled.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let out = "";
let $lineNumber = 1;
let $filename = "{{__dirname}}index.edge";
try {
out += template.stacks.create('js');
out += "\n";
$lineNumber = 2;
out += await template.compilePartial('push_to_multiple_via_components/script')(template,state,$context);
out += "\n";
$lineNumber = 3;
out += await template.compilePartial('push_to_multiple_via_components/script')(template,state,$context);
} catch (error) {
template.reThrow(error, $filename, $lineNumber);
}
return out;
3 changes: 3 additions & 0 deletions async_fixtures/push_to_multiple_via_paritals/index.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@stack('js')
@include('push_to_multiple_via_components/script')
@include('push_to_multiple_via_components/script')
3 changes: 3 additions & 0 deletions async_fixtures/push_to_multiple_via_paritals/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"username": "virk"
}
6 changes: 6 additions & 0 deletions async_fixtures/push_to_multiple_via_paritals/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
var a = require('a')
</script>
<script>
var a = require('a')
</script>
5 changes: 5 additions & 0 deletions async_fixtures/push_to_multiple_via_paritals/script.edge
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@pushTo('js')
<script>
var a = require('a')
</script>
@end
Loading

0 comments on commit 5714054

Please sign in to comment.