elegance-js 2.1.1 → 2.1.3
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/client/client.mjs
CHANGED
|
@@ -340,16 +340,6 @@ var loadPage = async (previousPage = null) => {
|
|
|
340
340
|
xmlSerializer.serializeToString(doc)
|
|
341
341
|
);
|
|
342
342
|
history.replaceState(null, "", fixedUrl.href);
|
|
343
|
-
{
|
|
344
|
-
const pageDataScript = document.head.querySelector(`script[data-page="true"][data-pathname="${sanitizePathname(pathname)}"]`);
|
|
345
|
-
const { data } = await import(pageDataScript.src);
|
|
346
|
-
if (!pd[pathname]) pd[pathname] = data;
|
|
347
|
-
{
|
|
348
|
-
const dataScript = document.querySelector(`script[data-hook="true"][data-pathname="${sanitizePathname(pathname)}"]`);
|
|
349
|
-
if (dataScript) dataScript.remove();
|
|
350
|
-
}
|
|
351
|
-
initPageData(pd[pathname], currentPage, previousPage, 1 /* STRICT */);
|
|
352
|
-
}
|
|
353
343
|
{
|
|
354
344
|
const parts = window.location.pathname.split("/").filter(Boolean);
|
|
355
345
|
const paths = [
|
|
@@ -370,6 +360,16 @@ var loadPage = async (previousPage = null) => {
|
|
|
370
360
|
initPageData(ld[pathname], path, previousPage, 2 /* SCOPED */);
|
|
371
361
|
}
|
|
372
362
|
}
|
|
363
|
+
{
|
|
364
|
+
const pageDataScript = document.head.querySelector(`script[data-page="true"][data-pathname="${sanitizePathname(pathname)}"]`);
|
|
365
|
+
const { data } = await import(pageDataScript.src);
|
|
366
|
+
if (!pd[pathname]) pd[pathname] = data;
|
|
367
|
+
{
|
|
368
|
+
const dataScript = document.querySelector(`script[data-hook="true"][data-pathname="${sanitizePathname(pathname)}"]`);
|
|
369
|
+
if (dataScript) dataScript.remove();
|
|
370
|
+
}
|
|
371
|
+
initPageData(pd[pathname], currentPage, previousPage, 1 /* STRICT */);
|
|
372
|
+
}
|
|
373
373
|
console.info(
|
|
374
374
|
`Loading finished, cleanupProcedures are currently:`,
|
|
375
375
|
cleanupProcedures
|
package/dist/page_compiler.mjs
CHANGED
|
@@ -228,8 +228,8 @@ var generateHTMLTemplate = async ({
|
|
|
228
228
|
StartTemplate += `<script data-module="true" src="/shipped/${globalName}.js" defer="true"></script>`;
|
|
229
229
|
}
|
|
230
230
|
if (addPageScriptTag === true) {
|
|
231
|
-
const sanitized = pageURL === "" ? "/" : pageURL
|
|
232
|
-
StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized}
|
|
231
|
+
const sanitized = pageURL === "" ? "/" : `/${pageURL}`;
|
|
232
|
+
StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized}/${name}_data.js" defer="true"></script>`;
|
|
233
233
|
}
|
|
234
234
|
StartTemplate += `<script type="module" src="/client.js" defer="true"></script>`;
|
|
235
235
|
let builtHead;
|
|
@@ -955,7 +955,7 @@ var pageToHTML = async (pageLocation, pageElements, metadata, DIST_DIR2, pageNam
|
|
|
955
955
|
"pd",
|
|
956
956
|
false
|
|
957
957
|
);
|
|
958
|
-
const sanitized = pathname === "" ? "/" : pathname
|
|
958
|
+
const sanitized = pathname === "" ? "/" : `/${pathname}`;
|
|
959
959
|
extraBodyHTML = `<script data-hook="true" data-pathname="${sanitized}" type="text/plain">${result}</script>`;
|
|
960
960
|
extraBodyHTML += `<script>
|
|
961
961
|
const text = document.querySelector('[data-hook="true"][data-pathname="${sanitized}"][type="text/plain"').textContent;
|
|
@@ -209,8 +209,8 @@ var generateHTMLTemplate = async ({
|
|
|
209
209
|
StartTemplate += `<script data-module="true" src="/shipped/${globalName}.js" defer="true"></script>`;
|
|
210
210
|
}
|
|
211
211
|
if (addPageScriptTag === true) {
|
|
212
|
-
const sanitized = pageURL === "" ? "/" : pageURL
|
|
213
|
-
StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized}
|
|
212
|
+
const sanitized = pageURL === "" ? "/" : `/${pageURL}`;
|
|
213
|
+
StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized}/${name}_data.js" defer="true"></script>`;
|
|
214
214
|
}
|
|
215
215
|
StartTemplate += `<script type="module" src="/client.js" defer="true"></script>`;
|
|
216
216
|
let builtHead;
|
package/dist/server/server.mjs
CHANGED
|
@@ -271,8 +271,8 @@ var generateHTMLTemplate = async ({
|
|
|
271
271
|
StartTemplate += `<script data-module="true" src="/shipped/${globalName}.js" defer="true"></script>`;
|
|
272
272
|
}
|
|
273
273
|
if (addPageScriptTag === true) {
|
|
274
|
-
const sanitized = pageURL === "" ? "/" : pageURL
|
|
275
|
-
StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized}
|
|
274
|
+
const sanitized = pageURL === "" ? "/" : `/${pageURL}`;
|
|
275
|
+
StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized}/${name}_data.js" defer="true"></script>`;
|
|
276
276
|
}
|
|
277
277
|
StartTemplate += `<script type="module" src="/client.js" defer="true"></script>`;
|
|
278
278
|
let builtHead;
|
|
@@ -594,7 +594,7 @@ var pageToHTML = async (pageLocation, pageElements, metadata, DIST_DIR2, pageNam
|
|
|
594
594
|
"pd",
|
|
595
595
|
false
|
|
596
596
|
);
|
|
597
|
-
const sanitized = pathname === "" ? "/" : pathname
|
|
597
|
+
const sanitized = pathname === "" ? "/" : `/${pathname}`;
|
|
598
598
|
extraBodyHTML = `<script data-hook="true" data-pathname="${sanitized}" type="text/plain">${result}</script>`;
|
|
599
599
|
extraBodyHTML += `<script>
|
|
600
600
|
const text = document.querySelector('[data-hook="true"][data-pathname="${sanitized}"][type="text/plain"').textContent;
|