elegance-js 2.0.9 → 2.0.11

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.
@@ -549,6 +549,10 @@ var pageToHTML = async (pageLocation, pageElements, metadata, DIST_DIR2, pageNam
549
549
  const resultHTML = `${headHTML}${bodyHTML}`;
550
550
  const htmlLocation = path.join(pageLocation, (pageName === "page" ? "index" : pageName) + ".html");
551
551
  if (doWrite) {
552
+ const dirname = path.dirname(htmlLocation);
553
+ if (fs.existsSync(dirname) === false) {
554
+ fs.mkdirSync(dirname, { recursive: true });
555
+ }
552
556
  fs.writeFileSync(
553
557
  htmlLocation,
554
558
  resultHTML,
@@ -792,10 +796,11 @@ var buildPages = async (DIST_DIR2) => {
792
796
  for (const file of files) {
793
797
  const filePath = path.join(file.parentPath, file.name);
794
798
  const name = file.name.slice(0, file.name.length - 3);
795
- const isPage = file.name.includes("page");
799
+ const isPage = name === "page";
796
800
  if (isPage == false) {
797
801
  continue;
798
802
  }
803
+ console.log("building page with", DIST_DIR2, `d: ${directory}`, filePath, name);
799
804
  try {
800
805
  const hardReloadForPage = await buildPage(DIST_DIR2, directory, filePath, name);
801
806
  if (hardReloadForPage) {
@@ -863,7 +868,7 @@ var buildPage = async (DIST_DIR2, directory, filePath, name) => {
863
868
  const objectAttributes = getObjectAttributes();
864
869
  const layout = await fetchPageLayoutHTML(path.dirname(filePath));
865
870
  const foundObjectAttributes = await pageToHTML(
866
- path.dirname(path.join(DIST_DIR2, directory)),
871
+ path.join(DIST_DIR2, directory),
867
872
  pageElements || body(),
868
873
  metadata ?? (() => head()),
869
874
  DIST_DIR2,
@@ -875,7 +880,7 @@ var buildPage = async (DIST_DIR2, directory, filePath, name) => {
875
880
  const {
876
881
  sendHardReloadInstruction
877
882
  } = await generateClientPageData(
878
- path.dirname(path.join(DIST_DIR2, directory)),
883
+ path.join(DIST_DIR2, directory),
879
884
  state || {},
880
885
  [...objectAttributes, ...foundObjectAttributes],
881
886
  pageLoadHooks || [],
@@ -943,7 +948,7 @@ var build = async () => {
943
948
  const pagesTranspiled = performance.now();
944
949
  let shouldClientHardReload;
945
950
  {
946
- const { shouldClientHardReload: doReload } = await buildPages(DIST_DIR);
951
+ const { shouldClientHardReload: doReload } = await buildPages(path.resolve(DIST_DIR));
947
952
  if (doReload) shouldClientHardReload = true;
948
953
  }
949
954
  const pagesBuilt = performance.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elegance-js",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "Web-Framework",
5
5
  "type": "module",
6
6
  "bin": {