elegance-js 1.11.29 → 1.11.31

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/build.mjs CHANGED
@@ -26,15 +26,14 @@ function color(text, code) {
26
26
  }
27
27
  function logInfo(...args) {
28
28
  if (quiet) return;
29
- console.info(`${getTimestamp()} ${color("[INFO]:", 34)}`, ...args);
29
+ console.info(`Elegance.JS: ${getTimestamp()} ${color("[INFO]:", 34)}`, ...args);
30
30
  }
31
31
  function logWarn(...args) {
32
32
  if (quiet) return;
33
- console.warn(`${getTimestamp()} ${color("[WARN]:", 33)}`, ...args);
33
+ console.warn(`Elegance.JS: ${getTimestamp()} ${color("[WARN]:", 33)}`, ...args);
34
34
  }
35
35
  function logError(...args) {
36
- if (quiet) return;
37
- console.error(`${getTimestamp()} ${color("[ERROR]:", 31)}`, ...args);
36
+ console.error(`Elegance.JS: ${getTimestamp()} ${color("[ERROR]:", 31)}`, ...args);
38
37
  }
39
38
  var log = {
40
39
  info: logInfo,
@@ -443,7 +442,9 @@ var generateSuitablePageElements = async (pageLocation, pageElements, metadata,
443
442
  };
444
443
  var generateClientPageData = async (pageLocation, state, objectAttributes, pageLoadHooks, DIST_DIR, pageName) => {
445
444
  const pageDiff = path.relative(DIST_DIR, pageLocation);
446
- let clientPageJSText = `let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
445
+ let clientPageJSText = `${globalThis.__SERVER_PAGE_DATA_BANNER__}
446
+ /*ELEGANCE_JS*/
447
+ let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
447
448
  {
448
449
  clientPageJSText += `export const data = {`;
449
450
  if (state) {
@@ -540,6 +541,7 @@ var buildDynamicPage = async (filePath, DIST_DIR, req, res) => {
540
541
  initializeState();
541
542
  initializeObjectAttributes();
542
543
  resetLoadHooks();
544
+ globalThis.__SERVER_PAGE_DATA_BANNER__ = "";
543
545
  globalThis.__SERVER_CURRENT_STATE_ID__ = 1;
544
546
  try {
545
547
  const {
@@ -570,7 +572,10 @@ var buildDynamicPage = async (filePath, DIST_DIR, req, res) => {
570
572
  throw new Error("Cannot dynamically render a non-dynamic page.");
571
573
  }
572
574
  } catch (e) {
573
- throw new Error(`Error in Dynamic Page: ${filePath} - ${e}`);
575
+ throw `${filePath} - ${e}
576
+ ${e?.stack ?? "No stack."}
577
+
578
+ `;
574
579
  }
575
580
  if (!metadata || metadata && typeof metadata !== "function") {
576
581
  console.warn(`WARNING: Dynamic ${filePath} does not export a metadata function. This is *highly* recommended.`);
@@ -29,15 +29,14 @@ function color(text, code) {
29
29
  }
30
30
  function logInfo(...args) {
31
31
  if (quiet) return;
32
- console.info(`${getTimestamp()} ${color("[INFO]:", 34)}`, ...args);
32
+ console.info(`Elegance.JS: ${getTimestamp()} ${color("[INFO]:", 34)}`, ...args);
33
33
  }
34
34
  function logWarn(...args) {
35
35
  if (quiet) return;
36
- console.warn(`${getTimestamp()} ${color("[WARN]:", 33)}`, ...args);
36
+ console.warn(`Elegance.JS: ${getTimestamp()} ${color("[WARN]:", 33)}`, ...args);
37
37
  }
38
38
  function logError(...args) {
39
- if (quiet) return;
40
- console.error(`${getTimestamp()} ${color("[ERROR]:", 31)}`, ...args);
39
+ console.error(`Elegance.JS: ${getTimestamp()} ${color("[ERROR]:", 31)}`, ...args);
41
40
  }
42
41
  var log = {
43
42
  info: logInfo,
@@ -446,7 +445,9 @@ var generateSuitablePageElements = async (pageLocation, pageElements, metadata,
446
445
  };
447
446
  var generateClientPageData = async (pageLocation, state, objectAttributes, pageLoadHooks, DIST_DIR, pageName) => {
448
447
  const pageDiff = path.relative(DIST_DIR, pageLocation);
449
- let clientPageJSText = `let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
448
+ let clientPageJSText = `${globalThis.__SERVER_PAGE_DATA_BANNER__}
449
+ /*ELEGANCE_JS*/
450
+ let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
450
451
  {
451
452
  clientPageJSText += `export const data = {`;
452
453
  if (state) {
@@ -543,6 +544,7 @@ var buildDynamicPage = async (filePath, DIST_DIR, req, res) => {
543
544
  initializeState();
544
545
  initializeObjectAttributes();
545
546
  resetLoadHooks();
547
+ globalThis.__SERVER_PAGE_DATA_BANNER__ = "";
546
548
  globalThis.__SERVER_CURRENT_STATE_ID__ = 1;
547
549
  try {
548
550
  const {
@@ -573,7 +575,10 @@ var buildDynamicPage = async (filePath, DIST_DIR, req, res) => {
573
575
  throw new Error("Cannot dynamically render a non-dynamic page.");
574
576
  }
575
577
  } catch (e) {
576
- throw new Error(`Error in Dynamic Page: ${filePath} - ${e}`);
578
+ throw `${filePath} - ${e}
579
+ ${e?.stack ?? "No stack."}
580
+
581
+ `;
577
582
  }
578
583
  if (!metadata || metadata && typeof metadata !== "function") {
579
584
  console.warn(`WARNING: Dynamic ${filePath} does not export a metadata function. This is *highly* recommended.`);
@@ -399,7 +399,9 @@ var generateSuitablePageElements = async (pageLocation, pageElements, metadata,
399
399
  };
400
400
  var generateClientPageData = async (pageLocation, state, objectAttributes, pageLoadHooks, DIST_DIR, pageName) => {
401
401
  const pageDiff = path.relative(DIST_DIR, pageLocation);
402
- let clientPageJSText = `let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
402
+ let clientPageJSText = `${globalThis.__SERVER_PAGE_DATA_BANNER__}
403
+ /*ELEGANCE_JS*/
404
+ let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
403
405
  {
404
406
  clientPageJSText += `export const data = {`;
405
407
  if (state) {
@@ -496,6 +498,7 @@ var buildDynamicPage = async (filePath, DIST_DIR, req, res) => {
496
498
  initializeState();
497
499
  initializeObjectAttributes();
498
500
  resetLoadHooks();
501
+ globalThis.__SERVER_PAGE_DATA_BANNER__ = "";
499
502
  globalThis.__SERVER_CURRENT_STATE_ID__ = 1;
500
503
  try {
501
504
  const {
@@ -526,7 +529,10 @@ var buildDynamicPage = async (filePath, DIST_DIR, req, res) => {
526
529
  throw new Error("Cannot dynamically render a non-dynamic page.");
527
530
  }
528
531
  } catch (e) {
529
- throw new Error(`Error in Dynamic Page: ${filePath} - ${e}`);
532
+ throw `${filePath} - ${e}
533
+ ${e?.stack ?? "No stack."}
534
+
535
+ `;
530
536
  }
531
537
  if (!metadata || metadata && typeof metadata !== "function") {
532
538
  console.warn(`WARNING: Dynamic ${filePath} does not export a metadata function. This is *highly* recommended.`);
package/dist/global.d.ts CHANGED
@@ -14,6 +14,8 @@ declare global {
14
14
  var __SERVER_CURRENT_LOADHOOKS__: Array<any>;
15
15
  var __SERVER_CURRENT_LAYOUTS__: Map<string, number>;
16
16
  var __SERVER_CURRENT_LAYOUT_ID__: number;
17
+ /** This is prepended to page_data.js */
18
+ var __SERVER_PAGE_DATA_BANNER__: string;
17
19
  type AnyBuiltElement = BuiltElement<ElementTags> | ChildrenLessBuiltElement<ChildrenlessElementTags>;
18
20
  type BuiltElement<T> = {
19
21
  tag: T;
package/dist/log.mjs CHANGED
@@ -19,15 +19,14 @@ function color(text, code) {
19
19
  }
20
20
  function logInfo(...args) {
21
21
  if (quiet) return;
22
- console.info(`${getTimestamp()} ${color("[INFO]:", 34)}`, ...args);
22
+ console.info(`Elegance.JS: ${getTimestamp()} ${color("[INFO]:", 34)}`, ...args);
23
23
  }
24
24
  function logWarn(...args) {
25
25
  if (quiet) return;
26
- console.warn(`${getTimestamp()} ${color("[WARN]:", 33)}`, ...args);
26
+ console.warn(`Elegance.JS: ${getTimestamp()} ${color("[WARN]:", 33)}`, ...args);
27
27
  }
28
28
  function logError(...args) {
29
- if (quiet) return;
30
- console.error(`${getTimestamp()} ${color("[ERROR]:", 31)}`, ...args);
29
+ console.error(`Elegance.JS: ${getTimestamp()} ${color("[ERROR]:", 31)}`, ...args);
31
30
  }
32
31
  var log = {
33
32
  info: logInfo,
@@ -553,7 +553,7 @@ var generateSuitablePageElements = async (pageLocation, pageElements, metadata,
553
553
  };
554
554
  var generateClientPageData = async (pageLocation, state, objectAttributes, pageLoadHooks, DIST_DIR2, pageName) => {
555
555
  const pageDiff = path.relative(DIST_DIR2, pageLocation);
556
- let clientPageJSText = `let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
556
+ let clientPageJSText = `${globalThis.__SERVER_PAGE_DATA_BANNER__}let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
557
557
  {
558
558
  clientPageJSText += `export const data = {`;
559
559
  if (state) {
@@ -677,6 +677,7 @@ var buildPage = async (DIST_DIR2, directory, filePath, name) => {
677
677
  initializeState();
678
678
  initializeObjectAttributes();
679
679
  resetLoadHooks();
680
+ globalThis.__SERVER_PAGE_DATA_BANNER__ = "";
680
681
  let pageElements;
681
682
  let metadata;
682
683
  try {
@@ -399,7 +399,9 @@ var generateSuitablePageElements = async (pageLocation, pageElements, metadata,
399
399
  };
400
400
  var generateClientPageData = async (pageLocation, state, objectAttributes, pageLoadHooks, DIST_DIR, pageName) => {
401
401
  const pageDiff = path.relative(DIST_DIR, pageLocation);
402
- let clientPageJSText = `let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
402
+ let clientPageJSText = `${globalThis.__SERVER_PAGE_DATA_BANNER__}
403
+ /*ELEGANCE_JS*/
404
+ let url="${pageDiff === "" ? "/" : `/${pageDiff}`}";`;
403
405
  {
404
406
  clientPageJSText += `export const data = {`;
405
407
  if (state) {
@@ -496,6 +498,7 @@ var buildDynamicPage = async (filePath, DIST_DIR, req, res) => {
496
498
  initializeState();
497
499
  initializeObjectAttributes();
498
500
  resetLoadHooks();
501
+ globalThis.__SERVER_PAGE_DATA_BANNER__ = "";
499
502
  globalThis.__SERVER_CURRENT_STATE_ID__ = 1;
500
503
  try {
501
504
  const {
@@ -526,7 +529,10 @@ var buildDynamicPage = async (filePath, DIST_DIR, req, res) => {
526
529
  throw new Error("Cannot dynamically render a non-dynamic page.");
527
530
  }
528
531
  } catch (e) {
529
- throw new Error(`Error in Dynamic Page: ${filePath} - ${e}`);
532
+ throw `${filePath} - ${e}
533
+ ${e?.stack ?? "No stack."}
534
+
535
+ `;
530
536
  }
531
537
  if (!metadata || metadata && typeof metadata !== "function") {
532
538
  console.warn(`WARNING: Dynamic ${filePath} does not export a metadata function. This is *highly* recommended.`);
@@ -586,15 +592,14 @@ function color(text, code) {
586
592
  }
587
593
  function logInfo(...args) {
588
594
  if (quiet) return;
589
- console.info(`${getTimestamp()} ${color("[INFO]:", 34)}`, ...args);
595
+ console.info(`Elegance.JS: ${getTimestamp()} ${color("[INFO]:", 34)}`, ...args);
590
596
  }
591
597
  function logWarn(...args) {
592
598
  if (quiet) return;
593
- console.warn(`${getTimestamp()} ${color("[WARN]:", 33)}`, ...args);
599
+ console.warn(`Elegance.JS: ${getTimestamp()} ${color("[WARN]:", 33)}`, ...args);
594
600
  }
595
601
  function logError(...args) {
596
- if (quiet) return;
597
- console.error(`${getTimestamp()} ${color("[ERROR]:", 31)}`, ...args);
602
+ console.error(`Elegance.JS: ${getTimestamp()} ${color("[ERROR]:", 31)}`, ...args);
598
603
  }
599
604
  var log = {
600
605
  info: logInfo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elegance-js",
3
- "version": "1.11.29",
3
+ "version": "1.11.31",
4
4
  "description": "Web-Framework",
5
5
  "type": "module",
6
6
  "bin": {