@valbuild/server 0.49.0 → 0.51.0
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.
@@ -320,7 +320,6 @@ const printer = ts__default["default"].createPrinter({
|
|
320
320
|
newLine: newLine
|
321
321
|
// neverAsciiEscape: true,
|
322
322
|
});
|
323
|
-
|
324
323
|
function replaceNodeValue(document, node, value) {
|
325
324
|
const replacementText = printer.printNode(ts__default["default"].EmitHint.Unspecified, toExpression(value), document);
|
326
325
|
const span = ts__default["default"].createTextSpanFromBounds(node.getStart(document, false), node.end);
|
@@ -663,7 +662,6 @@ const patchValFile = async (id, valConfigPath, patch$1, sourceFileHandler, runti
|
|
663
662
|
sourceFileHandler.writeSourceFile(newSourceFile.value);
|
664
663
|
// console.timeEnd("patchValFile" + timeId);
|
665
664
|
};
|
666
|
-
|
667
665
|
function convertDataUrlToBase64(dataUrl) {
|
668
666
|
const base64 = dataUrl.slice(dataUrl.indexOf(",") + 1);
|
669
667
|
return Buffer.from(base64, "base64");
|
@@ -888,7 +886,6 @@ class ValModuleLoader {
|
|
888
886
|
}
|
889
887
|
}
|
890
888
|
}
|
891
|
-
|
892
889
|
return compiledCode;
|
893
890
|
}
|
894
891
|
resolveModulePath(containingFilePath, requestedModuleName) {
|
@@ -1004,6 +1001,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1004
1001
|
value: "export const ValImage = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValImage' in this file`) } } } )"
|
1005
1002
|
};
|
1006
1003
|
}
|
1004
|
+
if (modulePath.includes("/ValApp")) {
|
1005
|
+
return {
|
1006
|
+
value: "export const ValApp = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValApp' in this file`) } } } )"
|
1007
|
+
};
|
1008
|
+
}
|
1007
1009
|
return {
|
1008
1010
|
value: moduleLoader.getModule(modulePath)
|
1009
1011
|
};
|
@@ -1059,6 +1061,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1059
1061
|
value: requestedName
|
1060
1062
|
};
|
1061
1063
|
}
|
1064
|
+
if (requestedName.includes("/ValApp")) {
|
1065
|
+
return {
|
1066
|
+
value: requestedName
|
1067
|
+
};
|
1068
|
+
}
|
1062
1069
|
const modulePath = moduleLoader.resolveModulePath(baseModuleName, requestedName);
|
1063
1070
|
return {
|
1064
1071
|
value: modulePath
|
@@ -1218,7 +1225,7 @@ class LocalValServer {
|
|
1218
1225
|
if (treePath && !path__namespace["default"].join(dir, file).replace(rootDir, "").startsWith(treePath)) {
|
1219
1226
|
continue;
|
1220
1227
|
}
|
1221
|
-
moduleIds.push(path__namespace["default"].join(dir, file).replace(rootDir, "").replace(".val.js", "").replace(".val.ts", ""));
|
1228
|
+
moduleIds.push(path__namespace["default"].join(dir, file).replace(rootDir, "").replace(".val.js", "").replace(".val.ts", "").split(path__namespace["default"].sep).join("/"));
|
1222
1229
|
}
|
1223
1230
|
}
|
1224
1231
|
};
|
@@ -1308,7 +1315,6 @@ class LocalValServer {
|
|
1308
1315
|
json: {} // no patch ids created
|
1309
1316
|
};
|
1310
1317
|
}
|
1311
|
-
|
1312
1318
|
badRequest() {
|
1313
1319
|
return {
|
1314
1320
|
status: 400,
|
@@ -1382,7 +1388,6 @@ function decodeJwt(token, secretKey) {
|
|
1382
1388
|
function getExpire() {
|
1383
1389
|
return Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 4; // 4 days
|
1384
1390
|
}
|
1385
|
-
|
1386
1391
|
const JwtHeaderSchema = z.z.object({
|
1387
1392
|
alg: z.z.literal("HS256"),
|
1388
1393
|
typ: z.z.literal("JWT")
|
@@ -1468,7 +1473,6 @@ class ProxyValServer {
|
|
1468
1473
|
}
|
1469
1474
|
}
|
1470
1475
|
},
|
1471
|
-
|
1472
1476
|
status: 302,
|
1473
1477
|
redirectTo: appAuthorizeUrl
|
1474
1478
|
};
|
@@ -1554,7 +1558,6 @@ class ProxyValServer {
|
|
1554
1558
|
}
|
1555
1559
|
}
|
1556
1560
|
},
|
1557
|
-
|
1558
1561
|
redirectTo: callbackReqSuccess.redirect_uri || "/"
|
1559
1562
|
};
|
1560
1563
|
}
|
@@ -2156,7 +2159,7 @@ function createValApiRouter(route, valServerPromise, convert) {
|
|
2156
2159
|
}
|
2157
2160
|
const path = url.pathname.slice(route.length);
|
2158
2161
|
if (path.startsWith("/static")) {
|
2159
|
-
return convert(await uiRequestHandler(path.slice("/static".length)));
|
2162
|
+
return convert(await uiRequestHandler(path.slice("/static".length), url.href));
|
2160
2163
|
} else if (path === "/session") {
|
2161
2164
|
return convert(await valServer.session(getCookies(req, [VAL_SESSION_COOKIE])));
|
2162
2165
|
} else if (path === "/authorize") {
|
@@ -320,7 +320,6 @@ const printer = ts__default["default"].createPrinter({
|
|
320
320
|
newLine: newLine
|
321
321
|
// neverAsciiEscape: true,
|
322
322
|
});
|
323
|
-
|
324
323
|
function replaceNodeValue(document, node, value) {
|
325
324
|
const replacementText = printer.printNode(ts__default["default"].EmitHint.Unspecified, toExpression(value), document);
|
326
325
|
const span = ts__default["default"].createTextSpanFromBounds(node.getStart(document, false), node.end);
|
@@ -663,7 +662,6 @@ const patchValFile = async (id, valConfigPath, patch$1, sourceFileHandler, runti
|
|
663
662
|
sourceFileHandler.writeSourceFile(newSourceFile.value);
|
664
663
|
// console.timeEnd("patchValFile" + timeId);
|
665
664
|
};
|
666
|
-
|
667
665
|
function convertDataUrlToBase64(dataUrl) {
|
668
666
|
const base64 = dataUrl.slice(dataUrl.indexOf(",") + 1);
|
669
667
|
return Buffer.from(base64, "base64");
|
@@ -888,7 +886,6 @@ class ValModuleLoader {
|
|
888
886
|
}
|
889
887
|
}
|
890
888
|
}
|
891
|
-
|
892
889
|
return compiledCode;
|
893
890
|
}
|
894
891
|
resolveModulePath(containingFilePath, requestedModuleName) {
|
@@ -1004,6 +1001,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1004
1001
|
value: "export const ValImage = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValImage' in this file`) } } } )"
|
1005
1002
|
};
|
1006
1003
|
}
|
1004
|
+
if (modulePath.includes("/ValApp")) {
|
1005
|
+
return {
|
1006
|
+
value: "export const ValApp = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValApp' in this file`) } } } )"
|
1007
|
+
};
|
1008
|
+
}
|
1007
1009
|
return {
|
1008
1010
|
value: moduleLoader.getModule(modulePath)
|
1009
1011
|
};
|
@@ -1059,6 +1061,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1059
1061
|
value: requestedName
|
1060
1062
|
};
|
1061
1063
|
}
|
1064
|
+
if (requestedName.includes("/ValApp")) {
|
1065
|
+
return {
|
1066
|
+
value: requestedName
|
1067
|
+
};
|
1068
|
+
}
|
1062
1069
|
const modulePath = moduleLoader.resolveModulePath(baseModuleName, requestedName);
|
1063
1070
|
return {
|
1064
1071
|
value: modulePath
|
@@ -1218,7 +1225,7 @@ class LocalValServer {
|
|
1218
1225
|
if (treePath && !path__namespace["default"].join(dir, file).replace(rootDir, "").startsWith(treePath)) {
|
1219
1226
|
continue;
|
1220
1227
|
}
|
1221
|
-
moduleIds.push(path__namespace["default"].join(dir, file).replace(rootDir, "").replace(".val.js", "").replace(".val.ts", ""));
|
1228
|
+
moduleIds.push(path__namespace["default"].join(dir, file).replace(rootDir, "").replace(".val.js", "").replace(".val.ts", "").split(path__namespace["default"].sep).join("/"));
|
1222
1229
|
}
|
1223
1230
|
}
|
1224
1231
|
};
|
@@ -1308,7 +1315,6 @@ class LocalValServer {
|
|
1308
1315
|
json: {} // no patch ids created
|
1309
1316
|
};
|
1310
1317
|
}
|
1311
|
-
|
1312
1318
|
badRequest() {
|
1313
1319
|
return {
|
1314
1320
|
status: 400,
|
@@ -1382,7 +1388,6 @@ function decodeJwt(token, secretKey) {
|
|
1382
1388
|
function getExpire() {
|
1383
1389
|
return Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 4; // 4 days
|
1384
1390
|
}
|
1385
|
-
|
1386
1391
|
const JwtHeaderSchema = z.z.object({
|
1387
1392
|
alg: z.z.literal("HS256"),
|
1388
1393
|
typ: z.z.literal("JWT")
|
@@ -1468,7 +1473,6 @@ class ProxyValServer {
|
|
1468
1473
|
}
|
1469
1474
|
}
|
1470
1475
|
},
|
1471
|
-
|
1472
1476
|
status: 302,
|
1473
1477
|
redirectTo: appAuthorizeUrl
|
1474
1478
|
};
|
@@ -1554,7 +1558,6 @@ class ProxyValServer {
|
|
1554
1558
|
}
|
1555
1559
|
}
|
1556
1560
|
},
|
1557
|
-
|
1558
1561
|
redirectTo: callbackReqSuccess.redirect_uri || "/"
|
1559
1562
|
};
|
1560
1563
|
}
|
@@ -2156,7 +2159,7 @@ function createValApiRouter(route, valServerPromise, convert) {
|
|
2156
2159
|
}
|
2157
2160
|
const path = url.pathname.slice(route.length);
|
2158
2161
|
if (path.startsWith("/static")) {
|
2159
|
-
return convert(await uiRequestHandler(path.slice("/static".length)));
|
2162
|
+
return convert(await uiRequestHandler(path.slice("/static".length), url.href));
|
2160
2163
|
} else if (path === "/session") {
|
2161
2164
|
return convert(await valServer.session(getCookies(req, [VAL_SESSION_COOKIE])));
|
2162
2165
|
} else if (path === "/authorize") {
|
@@ -290,7 +290,6 @@ const printer = ts.createPrinter({
|
|
290
290
|
newLine: newLine
|
291
291
|
// neverAsciiEscape: true,
|
292
292
|
});
|
293
|
-
|
294
293
|
function replaceNodeValue(document, node, value) {
|
295
294
|
const replacementText = printer.printNode(ts.EmitHint.Unspecified, toExpression(value), document);
|
296
295
|
const span = ts.createTextSpanFromBounds(node.getStart(document, false), node.end);
|
@@ -633,7 +632,6 @@ const patchValFile = async (id, valConfigPath, patch, sourceFileHandler, runtime
|
|
633
632
|
sourceFileHandler.writeSourceFile(newSourceFile.value);
|
634
633
|
// console.timeEnd("patchValFile" + timeId);
|
635
634
|
};
|
636
|
-
|
637
635
|
function convertDataUrlToBase64(dataUrl) {
|
638
636
|
const base64 = dataUrl.slice(dataUrl.indexOf(",") + 1);
|
639
637
|
return Buffer.from(base64, "base64");
|
@@ -858,7 +856,6 @@ class ValModuleLoader {
|
|
858
856
|
}
|
859
857
|
}
|
860
858
|
}
|
861
|
-
|
862
859
|
return compiledCode;
|
863
860
|
}
|
864
861
|
resolveModulePath(containingFilePath, requestedModuleName) {
|
@@ -974,6 +971,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
974
971
|
value: "export const ValImage = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValImage' in this file`) } } } )"
|
975
972
|
};
|
976
973
|
}
|
974
|
+
if (modulePath.includes("/ValApp")) {
|
975
|
+
return {
|
976
|
+
value: "export const ValApp = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValApp' in this file`) } } } )"
|
977
|
+
};
|
978
|
+
}
|
977
979
|
return {
|
978
980
|
value: moduleLoader.getModule(modulePath)
|
979
981
|
};
|
@@ -1029,6 +1031,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1029
1031
|
value: requestedName
|
1030
1032
|
};
|
1031
1033
|
}
|
1034
|
+
if (requestedName.includes("/ValApp")) {
|
1035
|
+
return {
|
1036
|
+
value: requestedName
|
1037
|
+
};
|
1038
|
+
}
|
1032
1039
|
const modulePath = moduleLoader.resolveModulePath(baseModuleName, requestedName);
|
1033
1040
|
return {
|
1034
1041
|
value: modulePath
|
@@ -1188,7 +1195,7 @@ class LocalValServer {
|
|
1188
1195
|
if (treePath && !path__default.join(dir, file).replace(rootDir, "").startsWith(treePath)) {
|
1189
1196
|
continue;
|
1190
1197
|
}
|
1191
|
-
moduleIds.push(path__default.join(dir, file).replace(rootDir, "").replace(".val.js", "").replace(".val.ts", ""));
|
1198
|
+
moduleIds.push(path__default.join(dir, file).replace(rootDir, "").replace(".val.js", "").replace(".val.ts", "").split(path__default.sep).join("/"));
|
1192
1199
|
}
|
1193
1200
|
}
|
1194
1201
|
};
|
@@ -1278,7 +1285,6 @@ class LocalValServer {
|
|
1278
1285
|
json: {} // no patch ids created
|
1279
1286
|
};
|
1280
1287
|
}
|
1281
|
-
|
1282
1288
|
badRequest() {
|
1283
1289
|
return {
|
1284
1290
|
status: 400,
|
@@ -1352,7 +1358,6 @@ function decodeJwt(token, secretKey) {
|
|
1352
1358
|
function getExpire() {
|
1353
1359
|
return Math.floor(Date.now() / 1000) + 60 * 60 * 24 * 4; // 4 days
|
1354
1360
|
}
|
1355
|
-
|
1356
1361
|
const JwtHeaderSchema = z$1.object({
|
1357
1362
|
alg: z$1.literal("HS256"),
|
1358
1363
|
typ: z$1.literal("JWT")
|
@@ -1438,7 +1443,6 @@ class ProxyValServer {
|
|
1438
1443
|
}
|
1439
1444
|
}
|
1440
1445
|
},
|
1441
|
-
|
1442
1446
|
status: 302,
|
1443
1447
|
redirectTo: appAuthorizeUrl
|
1444
1448
|
};
|
@@ -1524,7 +1528,6 @@ class ProxyValServer {
|
|
1524
1528
|
}
|
1525
1529
|
}
|
1526
1530
|
},
|
1527
|
-
|
1528
1531
|
redirectTo: callbackReqSuccess.redirect_uri || "/"
|
1529
1532
|
};
|
1530
1533
|
}
|
@@ -2126,7 +2129,7 @@ function createValApiRouter(route, valServerPromise, convert) {
|
|
2126
2129
|
}
|
2127
2130
|
const path = url.pathname.slice(route.length);
|
2128
2131
|
if (path.startsWith("/static")) {
|
2129
|
-
return convert(await uiRequestHandler(path.slice("/static".length)));
|
2132
|
+
return convert(await uiRequestHandler(path.slice("/static".length), url.href));
|
2130
2133
|
} else if (path === "/session") {
|
2131
2134
|
return convert(await valServer.session(getCookies(req, [VAL_SESSION_COOKIE])));
|
2132
2135
|
} else if (path === "/authorize") {
|
package/package.json
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
"./package.json": "./package.json"
|
13
13
|
},
|
14
14
|
"types": "dist/valbuild-server.cjs.d.ts",
|
15
|
-
"version": "0.
|
15
|
+
"version": "0.51.0",
|
16
16
|
"scripts": {
|
17
17
|
"typecheck": "tsc --noEmit",
|
18
18
|
"test": "jest",
|
@@ -24,9 +24,9 @@
|
|
24
24
|
"concurrently": "^7.6.0"
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
|
-
"@valbuild/core": "~0.
|
28
|
-
"@valbuild/shared": "~0.
|
29
|
-
"@valbuild/ui": "~0.
|
27
|
+
"@valbuild/core": "~0.51.0",
|
28
|
+
"@valbuild/shared": "~0.51.0",
|
29
|
+
"@valbuild/ui": "~0.51.0",
|
30
30
|
"express": "^4.18.2",
|
31
31
|
"image-size": "^1.0.2",
|
32
32
|
"queue": "^6.0.2",
|