elegance-js 2.1.14 → 2.1.16

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.d.ts CHANGED
@@ -1,26 +1,2 @@
1
- type CompilationOptions = {
2
- postCompile?: () => any;
3
- preCompile?: () => any;
4
- environment: "production" | "development";
5
- pagesDirectory: string;
6
- outputDirectory: string;
7
- /** Suppress native elegance logs. */
8
- quiet?: boolean;
9
- publicDirectory?: {
10
- path: string;
11
- };
12
- server?: {
13
- runServer: boolean;
14
- root?: string;
15
- port?: number;
16
- host?: string;
17
- };
18
- hotReload?: {
19
- port: number;
20
- hostname: string;
21
- /** Directories to watch for hot-reloading other than just the pagesDirectory. */
22
- extraWatchDirectories?: string[];
23
- };
24
- };
1
+ import { CompilationOptions } from "./compilation/compilation";
25
2
  export declare const compile: (props: CompilationOptions) => Promise<void>;
26
- export {};
package/dist/build.mjs CHANGED
@@ -6,6 +6,7 @@ import http from "http";
6
6
  import { startServer } from "./server/server";
7
7
  import { log, setQuiet } from "./log";
8
8
  import { populateServerMaps } from "./compilation/dynamic_compiler";
9
+ import { setCompilationOptions } from "./compilation/compilation";
9
10
  const __filename = fileURLToPath(import.meta.url);
10
11
  const __dirname = path.dirname(__filename);
11
12
  const packageDir = path.resolve(__dirname, "..");
@@ -89,12 +90,13 @@ const runBuild = (filepath, DIST_DIR) => {
89
90
  }
90
91
  } else if (data === "set-pages-and-layouts") {
91
92
  const { pageMap, layoutMap } = JSON.parse(message.content);
92
- populateServerMaps(pageMap, layoutMap);
93
+ populateServerMaps(new Map(pageMap), new Map(layoutMap));
93
94
  }
94
95
  });
95
96
  };
96
97
  const build = (DIST_DIR) => {
97
98
  runBuild(builderPath, DIST_DIR);
99
+ setCompilationOptions(options, DIST_DIR);
98
100
  };
99
101
  let isTimedOut = false;
100
102
  const currentWatchers = [];
@@ -6,6 +6,8 @@ type CompilationOptions = {
6
6
  environment: "production" | "development";
7
7
  pagesDirectory: string;
8
8
  outputDirectory: string;
9
+ /** Suppress native elegance logs. */
10
+ quiet?: boolean;
9
11
  publicDirectory?: {
10
12
  path: string;
11
13
  };
@@ -18,8 +20,9 @@ type CompilationOptions = {
18
20
  hotReload?: {
19
21
  port: number;
20
22
  hostname: string;
23
+ /** Directories to watch for hot-reloading other than just the pagesDirectory. */
24
+ extraWatchDirectories?: string[];
21
25
  };
22
- quiet: boolean;
23
26
  };
24
27
  declare const PAGE_MAP: Map<string, PageInformation>;
25
28
  declare const LAYOUT_MAP: Map<string, LayoutInformation>;
@@ -6,29 +6,36 @@ import { fileURLToPath } from "url";
6
6
  import { buildClient, buildLayouts, buildPages, retrievePageAndLayoutMaps, setCompilationOptions, shipModules } from "./compilation";
7
7
  let options = JSON.parse(process.env.OPTIONS || "{}");
8
8
  const DIST_DIR = process.env.DIST_DIR;
9
- const yellow = (text) => {
9
+ function yellow(text) {
10
10
  return `\x1B[38;2;238;184;68m${text}`;
11
- };
12
- const black = (text) => {
11
+ }
12
+ ;
13
+ function black(text) {
13
14
  return `\x1B[38;2;0;0;0m${text}`;
14
- };
15
- const bgYellow = (text) => {
15
+ }
16
+ ;
17
+ function bgYellow(text) {
16
18
  return `\x1B[48;2;238;184;68m${text}`;
17
- };
18
- const bold = (text) => {
19
+ }
20
+ ;
21
+ function bold(text) {
19
22
  return `\x1B[1m${text}`;
20
- };
21
- const underline = (text) => {
23
+ }
24
+ ;
25
+ function underline(text) {
22
26
  return `\x1B[4m${text}`;
23
- };
24
- const white = (text) => {
27
+ }
28
+ ;
29
+ function white(text) {
25
30
  return `\x1B[38;2;255;247;229m${text}`;
26
- };
27
- const log = (...text) => {
31
+ }
32
+ ;
33
+ function log(...text) {
28
34
  if (options.quiet) return;
29
35
  return console.log(text.map((text2) => `${text2}\x1B[0m`).join(""));
30
- };
31
- const build = async () => {
36
+ }
37
+ ;
38
+ async function build() {
32
39
  setCompilationOptions(options, DIST_DIR);
33
40
  try {
34
41
  {
@@ -91,5 +98,5 @@ const build = async () => {
91
98
  return false;
92
99
  }
93
100
  return true;
94
- };
101
+ }
95
102
  build();
@@ -86,7 +86,6 @@ async function buildDynamicPage(DIST_DIR, directory, pageInfo, req, res, middlew
86
86
  await shipModules();
87
87
  return { resultHTML };
88
88
  }
89
- ;
90
89
  function doesPageExist(pathname) {
91
90
  return PAGE_MAP.has(pathname);
92
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elegance-js",
3
- "version": "2.1.14",
3
+ "version": "2.1.16",
4
4
  "description": "Web-Framework",
5
5
  "type": "module",
6
6
  "bin": {