[rollup-plugin-html] does not extract assets within `<template>` tags
When processing HTML the rollup-plugin-html plugin skips extracting assets within <template> tags.
I've made myself a small build system that uses @lit-labs/ssr to generate HTML pages and noticed that the image assets of a components were not being extracted. I've generated this minimal page as an example. The /public/img/me.png asset is not being extracted or included in the build.
I've also reproduced using a css asset.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My app</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!--lit-part S7bmmAfnsS0=-->
<template>
<img src="/public/img/me.png" />
</template>
<!--/lit-part-->
</body>
</html>
Hypothesis:
parse5 treats the contents of a <template> as a documentFragment and it only exists as content and does not exist in childNodes and when parse5-utils traverses childNodes it does not find the contents of a template.
parse5-utils using getChildNodes to traverse the document for assets.
https://github.com/modernweb-dev/web/blob/d6a6112bc6c038fa6be6937e9e66b5d9c44476d3/packages/parse5-utils/src/index.js#L218