elegance-js 2.1.16 → 2.1.17
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
|
@@ -5,8 +5,7 @@ import child_process from "node:child_process";
|
|
|
5
5
|
import http from "http";
|
|
6
6
|
import { startServer } from "./server/server";
|
|
7
7
|
import { log, setQuiet } from "./log";
|
|
8
|
-
import { populateServerMaps } from "./compilation/
|
|
9
|
-
import { setCompilationOptions } from "./compilation/compilation";
|
|
8
|
+
import { populateServerMaps, setCompilationOptions } from "./compilation/compilation";
|
|
10
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
10
|
const __dirname = path.dirname(__filename);
|
|
12
11
|
const packageDir = path.resolve(__dirname, "..");
|
|
@@ -24,8 +24,10 @@ type CompilationOptions = {
|
|
|
24
24
|
extraWatchDirectories?: string[];
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
declare
|
|
28
|
-
declare
|
|
27
|
+
declare let PAGE_MAP: Map<string, PageInformation>;
|
|
28
|
+
declare let LAYOUT_MAP: Map<string, LayoutInformation>;
|
|
29
|
+
/** The parent process calls this in order to set the LAYOUT_MAP and PAGE_MAP to the ones that that compiler process ended up with. */
|
|
30
|
+
declare function populateServerMaps(pageMap: Map<any, any>, layoutMap: Map<any, any>): void;
|
|
29
31
|
/** A list of modules that are yet to be built. */
|
|
30
32
|
declare let modulesToShip: Array<{
|
|
31
33
|
path: string;
|
|
@@ -134,4 +136,4 @@ declare function retrievePageAndLayoutMaps(): {
|
|
|
134
136
|
LAYOUT_MAP: Map<string, LayoutInformation>;
|
|
135
137
|
PAGE_MAP: Map<string, PageInformation>;
|
|
136
138
|
};
|
|
137
|
-
export { CompilationOptions, setCompilationOptions, getAllSubdirectories, retrievePageAndLayoutMaps, buildClient, processPageElements, pageToHTML, generateClientPageData, generateLayout, buildLayouts, buildLayout, fetchPageLayoutHTML, buildPages, buildPage, shipModules, PAGE_MAP, LAYOUT_MAP, modulesToShip, };
|
|
139
|
+
export { CompilationOptions, setCompilationOptions, getAllSubdirectories, retrievePageAndLayoutMaps, buildClient, processPageElements, pageToHTML, generateClientPageData, generateLayout, buildLayouts, buildLayout, fetchPageLayoutHTML, buildPages, buildPage, shipModules, PAGE_MAP, LAYOUT_MAP, populateServerMaps, modulesToShip, };
|
|
@@ -11,8 +11,12 @@ import { getState, initializeState, initializeObjectAttributes, getObjectAttribu
|
|
|
11
11
|
import { getLoadHooks, resetLoadHooks } from "../server/loadHook";
|
|
12
12
|
import { resetLayouts } from "../server/layout";
|
|
13
13
|
import { renderRecursively } from "../server/render";
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
let PAGE_MAP = /* @__PURE__ */ new Map();
|
|
15
|
+
let LAYOUT_MAP = /* @__PURE__ */ new Map();
|
|
16
|
+
function populateServerMaps(pageMap, layoutMap) {
|
|
17
|
+
LAYOUT_MAP = layoutMap;
|
|
18
|
+
PAGE_MAP = pageMap;
|
|
19
|
+
}
|
|
16
20
|
let options;
|
|
17
21
|
let DIST_DIR;
|
|
18
22
|
let elementKey = 0;
|
|
@@ -730,6 +734,7 @@ export {
|
|
|
730
734
|
getAllSubdirectories,
|
|
731
735
|
modulesToShip,
|
|
732
736
|
pageToHTML,
|
|
737
|
+
populateServerMaps,
|
|
733
738
|
processPageElements,
|
|
734
739
|
retrievePageAndLayoutMaps,
|
|
735
740
|
setCompilationOptions,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from "http";
|
|
2
|
-
/** Populate layout and page map for the server, so it knows what pages exist within the project. */
|
|
3
|
-
declare function populateServerMaps(pageMap: Map<any, any>, layoutMap: Map<any, any>): void;
|
|
4
2
|
/** Render a page that has been deemed dynamic. */
|
|
5
3
|
declare function buildDynamicPage(DIST_DIR: string, directory: string, pageInfo: PageInformation, req: IncomingMessage, res: ServerResponse, middlewareData: MiddlewareData): Promise<false | {
|
|
6
4
|
resultHTML: any;
|
|
@@ -8,5 +6,5 @@ declare function buildDynamicPage(DIST_DIR: string, directory: string, pageInfo:
|
|
|
8
6
|
/** Check if a given pathname was found during the original compilation process. */
|
|
9
7
|
declare function doesPageExist(pathname: string): boolean;
|
|
10
8
|
/** Retrieve a given pathname from the page map. */
|
|
11
|
-
declare function getPage(pathname: string):
|
|
12
|
-
export {
|
|
9
|
+
declare function getPage(pathname: string): PageInformation | undefined;
|
|
10
|
+
export { doesPageExist, getPage, buildDynamicPage, };
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { initializeObjectAttributes, initializeState } from "../server/state";
|
|
2
2
|
import { resetLoadHooks } from "../server/loadHook";
|
|
3
|
-
import { fetchPageLayoutHTML, pageToHTML, shipModules, modulesToShip } from "./compilation";
|
|
3
|
+
import { fetchPageLayoutHTML, pageToHTML, shipModules, modulesToShip, PAGE_MAP } from "./compilation";
|
|
4
4
|
import path from "path";
|
|
5
|
-
let LAYOUT_MAP = /* @__PURE__ */ new Map();
|
|
6
|
-
let PAGE_MAP = /* @__PURE__ */ new Map();
|
|
7
|
-
function populateServerMaps(pageMap, layoutMap) {
|
|
8
|
-
LAYOUT_MAP = layoutMap;
|
|
9
|
-
PAGE_MAP = pageMap;
|
|
10
|
-
}
|
|
11
5
|
async function buildDynamicPage(DIST_DIR, directory, pageInfo, req, res, middlewareData) {
|
|
12
6
|
directory = directory === "/" ? "" : directory;
|
|
13
7
|
const filePath = pageInfo.filePath;
|
|
@@ -95,6 +89,5 @@ function getPage(pathname) {
|
|
|
95
89
|
export {
|
|
96
90
|
buildDynamicPage,
|
|
97
91
|
doesPageExist,
|
|
98
|
-
getPage
|
|
99
|
-
populateServerMaps
|
|
92
|
+
getPage
|
|
100
93
|
};
|