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