@valbuild/ui 0.60.10 → 0.60.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/ui",
3
- "version": "0.60.10",
3
+ "version": "0.60.11",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
@@ -41,8 +41,8 @@
41
41
  "@remirror/pm": "^2.0.8",
42
42
  "@remirror/react": "^2.0.35",
43
43
  "@remirror/styles": "^2.0.7",
44
- "@valbuild/core": "~0.60.10",
45
- "@valbuild/shared": "~0.60.10",
44
+ "@valbuild/core": "~0.60.11",
45
+ "@valbuild/shared": "~0.60.11",
46
46
  "class-variance-authority": "^0.7.0",
47
47
  "classnames": "^2.3.2",
48
48
  "clsx": "^2.0.0",
@@ -63,18 +63,14 @@ function createUIRequestHandler() {
63
63
  );
64
64
  }
65
65
  const MAIN_CSS_FILE = cssFiles[0];
66
+ const htmlPage = decodedFiles["/index.html"];
67
+ if (!htmlPage) {
68
+ throw new Error(
69
+ "Val UI files missing (error: no index.html file found)! This Val version or build is corrupted!"
70
+ );
71
+ }
66
72
  return async (path, url) => {
67
- if (path === "/" || path === "") {
68
- return {
69
- status: 200,
70
- headers: {
71
- "Content-Type": getServerMimeType(path) || "",
72
- "Cache-Control": "max-age=90"
73
- // TODO: change this to something more aggressive
74
- },
75
- body: decodedFiles["/index.html"]
76
- };
77
- } else if (path === VAL_APP_PATH) {
73
+ if (path === VAL_APP_PATH) {
78
74
  return {
79
75
  status: 302,
80
76
  redirectTo: url.replace(path, MAIN_FILE)
@@ -96,13 +92,13 @@ function createUIRequestHandler() {
96
92
  };
97
93
  } else {
98
94
  return {
99
- status: 404,
100
- json: {
101
- message: `Val UI file not found: ${path}`,
102
- details: {
103
- files: Object.keys(files)
104
- }
105
- }
95
+ status: 200,
96
+ headers: {
97
+ "Content-Type": getServerMimeType(path) || "",
98
+ "Cache-Control": "max-age=90"
99
+ // TODO: change this to something more aggressive
100
+ },
101
+ body: htmlPage
106
102
  };
107
103
  }
108
104
  }
@@ -61,18 +61,14 @@ function createUIRequestHandler() {
61
61
  );
62
62
  }
63
63
  const MAIN_CSS_FILE = cssFiles[0];
64
+ const htmlPage = decodedFiles["/index.html"];
65
+ if (!htmlPage) {
66
+ throw new Error(
67
+ "Val UI files missing (error: no index.html file found)! This Val version or build is corrupted!"
68
+ );
69
+ }
64
70
  return async (path, url) => {
65
- if (path === "/" || path === "") {
66
- return {
67
- status: 200,
68
- headers: {
69
- "Content-Type": getServerMimeType(path) || "",
70
- "Cache-Control": "max-age=90"
71
- // TODO: change this to something more aggressive
72
- },
73
- body: decodedFiles["/index.html"]
74
- };
75
- } else if (path === VAL_APP_PATH) {
71
+ if (path === VAL_APP_PATH) {
76
72
  return {
77
73
  status: 302,
78
74
  redirectTo: url.replace(path, MAIN_FILE)
@@ -94,13 +90,13 @@ function createUIRequestHandler() {
94
90
  };
95
91
  } else {
96
92
  return {
97
- status: 404,
98
- json: {
99
- message: `Val UI file not found: ${path}`,
100
- details: {
101
- files: Object.keys(files)
102
- }
103
- }
93
+ status: 200,
94
+ headers: {
95
+ "Content-Type": getServerMimeType(path) || "",
96
+ "Cache-Control": "max-age=90"
97
+ // TODO: change this to something more aggressive
98
+ },
99
+ body: htmlPage
104
100
  };
105
101
  }
106
102
  }