elegance-js 2.1.2 → 2.1.4

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.
@@ -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
@@ -229,7 +229,7 @@ var generateHTMLTemplate = async ({
229
229
  }
230
230
  if (addPageScriptTag === true) {
231
231
  const sanitized = pageURL === "" ? "/" : `/${pageURL}`;
232
- StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized}/${name}_data.js" defer="true"></script>`;
232
+ StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized.endsWith("/") ? sanitized : 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;
@@ -210,7 +210,7 @@ var generateHTMLTemplate = async ({
210
210
  }
211
211
  if (addPageScriptTag === true) {
212
212
  const sanitized = pageURL === "" ? "/" : `/${pageURL}`;
213
- StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized}/${name}_data.js" defer="true"></script>`;
213
+ StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized.endsWith("/") ? sanitized : 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;
@@ -272,7 +272,7 @@ var generateHTMLTemplate = async ({
272
272
  }
273
273
  if (addPageScriptTag === true) {
274
274
  const sanitized = pageURL === "" ? "/" : `/${pageURL}`;
275
- StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized}/${name}_data.js" defer="true"></script>`;
275
+ StartTemplate += `<script data-page="true" type="module" data-pathname="${sanitized}" src="${sanitized.endsWith("/") ? sanitized : 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elegance-js",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Web-Framework",
5
5
  "type": "module",
6
6
  "bin": {