@marko/vite 5.1.3 → 5.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +10 -7
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -651,16 +651,19 @@ function renderAssets(slot) {
651
651
  // To avoid FOUC we will hide the page until all of these modules are loaded.
652
652
  const { preload } = entry;
653
653
  if (preload) {
654
- html += \`<script class=marko-vite-preload async blocking=render type=module\${this.___viteInjectAttrs}>\`;
654
+ let sep = "";
655
+ html += \`<style marko-vite-preload\${this.___viteInjectAttrs}>html{visibility:hidden !important}</style>\`;
656
+ html += \`<script marko-vite-preload async blocking=render type=module\${this.___viteInjectAttrs}>\`;
657
+ html += "await Promise.allSettled([";
658
+
655
659
  for (const id of preload) {
656
- html += \`import \${JSON.stringify(base + id)};\`;
660
+ html += sep + \`import(\${JSON.stringify(base + id)})\`;
661
+ sep = ",";
657
662
  }
658
663
 
659
- html += "document.querySelectorAll('.marko-vite-preload').forEach((el) => el.remove());";
660
- html += "document.documentElement.style.visibility='';";
661
- html +=
662
- "if(document.documentElement.getAttribute('style')==='')document.documentElement.removeAttribute('style');";
663
- html += \`</script><script class=marko-vite-preload\${this.___viteInjectAttrs}>document.documentElement.style.visibility='hidden'</script>\`;
664
+ html += "]);";
665
+ html += "document.querySelectorAll('[marko-vite-preload]').forEach(el=>el.remove());";
666
+ html += \`</script>\`;
664
667
  }
665
668
  }`}
666
669
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
- "version": "5.1.3",
3
+ "version": "5.1.5",
4
4
  "description": "A Marko plugin for Vite",
5
5
  "keywords": [
6
6
  "loader",