diorama-js 0.2.0 → 0.2.1

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.
package/dist/svelte.cjs CHANGED
@@ -1838,6 +1838,7 @@ ${importMapJSON}
1838
1838
  );
1839
1839
  }
1840
1840
  }
1841
+ html = injectIntoHead(html, `<script>${HISTORY_GUARD_SCRIPT}</script>`);
1841
1842
  return { html, usesESM: true };
1842
1843
  }
1843
1844
  function generateHTMLShell(files, config) {
@@ -2106,12 +2107,13 @@ function applyTailwindRuntime(html, project, config, tailwind) {
2106
2107
  /<style>([\s\S]*?)<\/style>/g,
2107
2108
  (match, css) => hasTailwindDirectives(css) ? `<style type="text/tailwindcss">${css}</style>` : match
2108
2109
  );
2109
- let injection = `<script src="${TAILWIND_CDN_URL}"></script>`;
2110
+ let injection = "";
2110
2111
  const configObject = extractTailwindConfig(project.files);
2111
2112
  if (configObject) {
2112
- injection += `
2113
- <script>tailwind.config = ${configObject};</script>`;
2113
+ injection += `<script>window.tailwind = { config: ${configObject} };</script>
2114
+ `;
2114
2115
  }
2116
+ injection += `<script src="${TAILWIND_CDN_URL}" defer></script>`;
2115
2117
  return injectIntoHead(html, injection);
2116
2118
  }
2117
2119
  function extractTailwindConfig(files) {
@@ -2182,6 +2184,7 @@ function extractBalancedObject(source) {
2182
2184
  function isSafeConfigObject(object) {
2183
2185
  return !(/\brequire\s*\(/.test(object) || /\bimport\b/.test(object) || /=>/.test(object) || /\bfunction\b/.test(object) || /`/.test(object) || /\bprocess\b/.test(object) || /\b__dirname\b|\b__filename\b/.test(object));
2184
2186
  }
2187
+ var HISTORY_GUARD_SCRIPT = "try{for(const m of ['pushState','replaceState']){const orig=history[m].bind(history);history[m]=function(state,title,url){try{return orig(state,title,url);}catch(e){try{return orig(state,title);}catch(e2){}}};}}catch(e){}";
2185
2188
  function injectImportMetaEnv(files) {
2186
2189
  const shim = `if(!import.meta.env){Object.defineProperty(import.meta,'env',{value:{MODE:'production',BASE_URL:'/',PROD:true,DEV:false,SSR:false}});}`;
2187
2190
  for (const [path, content] of files) {