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