prevent hanging with large numbers of links (#604)

This commit is contained in:
Rich Harris
2019-04-29 13:10:15 -04:00
parent 1707fe8e9d
commit bc8e5501cd
7 changed files with 63 additions and 18 deletions

View File

@@ -0,0 +1,12 @@
<script context="module">
export function preload({ params }) {
return params;
}
</script>
<script>
export let a;
export let b;
</script>
<p>{a}/{b}</p>

View File

@@ -0,0 +1,15 @@
<script context="module">
export function preload({ params }) {
return params;
}
</script>
<script>
export let a;
const list = Array(20).fill().map((_, i) => i + 1);
</script>
{#each list as b}
<a href="boom/{a}/{b}">{a}/{b}</a>
{/each}

View File

@@ -0,0 +1,7 @@
<script>
const list = Array(20).fill().map((_, i) => i + 1);
</script>
{#each list as a}
<a href="boom/{a}">{a}</a>
{/each}

View File

@@ -7,3 +7,4 @@
<a href= >empty anchor #4</a>
<a href>empty anchor #5</a>
<a>empty anchor #6</a>
<a href="boom">boom</a>

View File

@@ -19,7 +19,15 @@ describe('export', function() {
assert.ok(client_assets.length > 0);
assert.deepEqual(non_client_assets, [
const boom = ['boom/index.html'];
for (let a = 1; a <= 20; a += 1) {
boom.push(`boom/${a}/index.html`);
for (let b = 1; b <= 20; b += 1) {
boom.push(`boom/${a}/${b}/index.html`);
}
}
assert.deepEqual(non_client_assets.sort(), [
'blog.json',
'blog/bar.json',
'blog/bar/index.html',
@@ -31,8 +39,9 @@ describe('export', function() {
'global.css',
'index.html',
'service-worker-index.html',
'service-worker.js'
]);
'service-worker.js',
...boom
].sort());
});
// TODO test timeout, basepath