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/vue.js CHANGED
@@ -1840,6 +1840,7 @@ ${importMapJSON}
1840
1840
  );
1841
1841
  }
1842
1842
  }
1843
+ html = injectIntoHead(html, `<script>${HISTORY_GUARD_SCRIPT}</script>`);
1843
1844
  return { html, usesESM: true };
1844
1845
  }
1845
1846
  function generateHTMLShell(files, config) {
@@ -2108,12 +2109,13 @@ function applyTailwindRuntime(html, project, config, tailwind) {
2108
2109
  /<style>([\s\S]*?)<\/style>/g,
2109
2110
  (match, css) => hasTailwindDirectives(css) ? `<style type="text/tailwindcss">${css}</style>` : match
2110
2111
  );
2111
- let injection = `<script src="${TAILWIND_CDN_URL}"></script>`;
2112
+ let injection = "";
2112
2113
  const configObject = extractTailwindConfig(project.files);
2113
2114
  if (configObject) {
2114
- injection += `
2115
- <script>tailwind.config = ${configObject};</script>`;
2115
+ injection += `<script>window.tailwind = { config: ${configObject} };</script>
2116
+ `;
2116
2117
  }
2118
+ injection += `<script src="${TAILWIND_CDN_URL}" defer></script>`;
2117
2119
  return injectIntoHead(html, injection);
2118
2120
  }
2119
2121
  function extractTailwindConfig(files) {
@@ -2184,6 +2186,7 @@ function extractBalancedObject(source) {
2184
2186
  function isSafeConfigObject(object) {
2185
2187
  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));
2186
2188
  }
2189
+ 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){}";
2187
2190
  function injectImportMetaEnv(files) {
2188
2191
  const shim = `if(!import.meta.env){Object.defineProperty(import.meta,'env',{value:{MODE:'production',BASE_URL:'/',PROD:true,DEV:false,SSR:false}});}`;
2189
2192
  for (const [path, content] of files) {