@valbuild/server 0.35.0 → 0.37.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.
@@ -696,7 +696,7 @@ globalThis.valModule = {
696
696
  const fatalErrors = [];
697
697
  if (result.error) {
698
698
  const error = result.error.consume(context.dump);
699
- console.error(`Fatal error reading val file: ${error.message}\n`, error.stack);
699
+ console.error(`Fatal error reading val file: ${id}. Error: ${error.message}\n`, error.stack);
700
700
  return {
701
701
  path: id,
702
702
  errors: {
@@ -951,9 +951,14 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
951
951
  value: "export const useVal = () => { throw Error(`Cannot use 'useVal' in this type of file`) }; export const fetchVal = () => { throw Error(`Cannot use 'fetchVal' in this type of file`) }; export const autoTagJSX = () => { /* ignore */ };"
952
952
  };
953
953
  }
954
+ if (modulePath.startsWith("next/navigation")) {
955
+ return {
956
+ value: "export const useRouter = () => { throw Error(`Cannot use 'useRouter' in this type of file`) }; export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'next' in this file`) } } } );"
957
+ };
958
+ }
954
959
  if (modulePath.startsWith("next")) {
955
960
  return {
956
- value: "export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'next' in this file`) } } } )"
961
+ value: "export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'next' in this file`) } } } );"
957
962
  };
958
963
  }
959
964
  if (modulePath.startsWith("react")) {
@@ -961,7 +966,7 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
961
966
  value: "export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'react' in this file`) } } } )"
962
967
  };
963
968
  }
964
- if (modulePath === "./ValNextProvider") {
969
+ if (modulePath.includes("/ValNextProvider")) {
965
970
  return {
966
971
  value: "export const ValNextProvider = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValProvider' in this file`) } } } )"
967
972
  };
@@ -991,6 +996,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
991
996
  value: requestedName
992
997
  };
993
998
  }
999
+ if (requestedName.startsWith("next/navigation")) {
1000
+ return {
1001
+ value: requestedName
1002
+ };
1003
+ }
994
1004
  if (requestedName.startsWith("next")) {
995
1005
  return {
996
1006
  value: requestedName
@@ -1001,7 +1011,7 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
1001
1011
  value: requestedName
1002
1012
  };
1003
1013
  }
1004
- if (requestedName === "./ValNextProvider") {
1014
+ if (requestedName.includes("/ValNextProvider")) {
1005
1015
  return {
1006
1016
  value: requestedName
1007
1017
  };
@@ -1348,7 +1358,7 @@ class ProxyValServer {
1348
1358
  }
1349
1359
  async getFiles(treePath, query, cookies) {
1350
1360
  return this.withAuth(cookies, "getFiles", async data => {
1351
- const url = new URL(`/v1/files/${this.options.valName}/${treePath}`, this.options.valContentUrl);
1361
+ const url = new URL(`/v1/files/${this.options.valName}/~${treePath}`, this.options.valContentUrl);
1352
1362
  if (typeof query.sha256 === "string") {
1353
1363
  url.searchParams.append("sha256", query.sha256);
1354
1364
  } else {
@@ -1600,7 +1610,7 @@ class ProxyValServer {
1600
1610
  source: (source === "true").toString(),
1601
1611
  commit
1602
1612
  });
1603
- const url = new URL(`/v1/tree/${this.options.valName}/heads/${this.options.gitBranch}/${treePath}/?${params}`, this.options.valContentUrl);
1613
+ const url = new URL(`/v1/tree/${this.options.valName}/heads/${this.options.gitBranch}/~${treePath}/?${params}`, this.options.valContentUrl);
1604
1614
  try {
1605
1615
  const fetchRes = await fetch(url, {
1606
1616
  headers: this.getAuthHeaders(data.token, "application/json")
@@ -696,7 +696,7 @@ globalThis.valModule = {
696
696
  const fatalErrors = [];
697
697
  if (result.error) {
698
698
  const error = result.error.consume(context.dump);
699
- console.error(`Fatal error reading val file: ${error.message}\n`, error.stack);
699
+ console.error(`Fatal error reading val file: ${id}. Error: ${error.message}\n`, error.stack);
700
700
  return {
701
701
  path: id,
702
702
  errors: {
@@ -951,9 +951,14 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
951
951
  value: "export const useVal = () => { throw Error(`Cannot use 'useVal' in this type of file`) }; export const fetchVal = () => { throw Error(`Cannot use 'fetchVal' in this type of file`) }; export const autoTagJSX = () => { /* ignore */ };"
952
952
  };
953
953
  }
954
+ if (modulePath.startsWith("next/navigation")) {
955
+ return {
956
+ value: "export const useRouter = () => { throw Error(`Cannot use 'useRouter' in this type of file`) }; export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'next' in this file`) } } } );"
957
+ };
958
+ }
954
959
  if (modulePath.startsWith("next")) {
955
960
  return {
956
- value: "export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'next' in this file`) } } } )"
961
+ value: "export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'next' in this file`) } } } );"
957
962
  };
958
963
  }
959
964
  if (modulePath.startsWith("react")) {
@@ -961,7 +966,7 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
961
966
  value: "export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'react' in this file`) } } } )"
962
967
  };
963
968
  }
964
- if (modulePath === "./ValNextProvider") {
969
+ if (modulePath.includes("/ValNextProvider")) {
965
970
  return {
966
971
  value: "export const ValNextProvider = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValProvider' in this file`) } } } )"
967
972
  };
@@ -991,6 +996,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
991
996
  value: requestedName
992
997
  };
993
998
  }
999
+ if (requestedName.startsWith("next/navigation")) {
1000
+ return {
1001
+ value: requestedName
1002
+ };
1003
+ }
994
1004
  if (requestedName.startsWith("next")) {
995
1005
  return {
996
1006
  value: requestedName
@@ -1001,7 +1011,7 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
1001
1011
  value: requestedName
1002
1012
  };
1003
1013
  }
1004
- if (requestedName === "./ValNextProvider") {
1014
+ if (requestedName.includes("/ValNextProvider")) {
1005
1015
  return {
1006
1016
  value: requestedName
1007
1017
  };
@@ -1348,7 +1358,7 @@ class ProxyValServer {
1348
1358
  }
1349
1359
  async getFiles(treePath, query, cookies) {
1350
1360
  return this.withAuth(cookies, "getFiles", async data => {
1351
- const url = new URL(`/v1/files/${this.options.valName}/${treePath}`, this.options.valContentUrl);
1361
+ const url = new URL(`/v1/files/${this.options.valName}/~${treePath}`, this.options.valContentUrl);
1352
1362
  if (typeof query.sha256 === "string") {
1353
1363
  url.searchParams.append("sha256", query.sha256);
1354
1364
  } else {
@@ -1600,7 +1610,7 @@ class ProxyValServer {
1600
1610
  source: (source === "true").toString(),
1601
1611
  commit
1602
1612
  });
1603
- const url = new URL(`/v1/tree/${this.options.valName}/heads/${this.options.gitBranch}/${treePath}/?${params}`, this.options.valContentUrl);
1613
+ const url = new URL(`/v1/tree/${this.options.valName}/heads/${this.options.gitBranch}/~${treePath}/?${params}`, this.options.valContentUrl);
1604
1614
  try {
1605
1615
  const fetchRes = await fetch(url, {
1606
1616
  headers: this.getAuthHeaders(data.token, "application/json")
@@ -666,7 +666,7 @@ globalThis.valModule = {
666
666
  const fatalErrors = [];
667
667
  if (result.error) {
668
668
  const error = result.error.consume(context.dump);
669
- console.error(`Fatal error reading val file: ${error.message}\n`, error.stack);
669
+ console.error(`Fatal error reading val file: ${id}. Error: ${error.message}\n`, error.stack);
670
670
  return {
671
671
  path: id,
672
672
  errors: {
@@ -921,9 +921,14 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
921
921
  value: "export const useVal = () => { throw Error(`Cannot use 'useVal' in this type of file`) }; export const fetchVal = () => { throw Error(`Cannot use 'fetchVal' in this type of file`) }; export const autoTagJSX = () => { /* ignore */ };"
922
922
  };
923
923
  }
924
+ if (modulePath.startsWith("next/navigation")) {
925
+ return {
926
+ value: "export const useRouter = () => { throw Error(`Cannot use 'useRouter' in this type of file`) }; export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'next' in this file`) } } } );"
927
+ };
928
+ }
924
929
  if (modulePath.startsWith("next")) {
925
930
  return {
926
- value: "export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'next' in this file`) } } } )"
931
+ value: "export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'next' in this file`) } } } );"
927
932
  };
928
933
  }
929
934
  if (modulePath.startsWith("react")) {
@@ -931,7 +936,7 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
931
936
  value: "export default new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'react' in this file`) } } } )"
932
937
  };
933
938
  }
934
- if (modulePath === "./ValNextProvider") {
939
+ if (modulePath.includes("/ValNextProvider")) {
935
940
  return {
936
941
  value: "export const ValNextProvider = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValProvider' in this file`) } } } )"
937
942
  };
@@ -961,6 +966,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
961
966
  value: requestedName
962
967
  };
963
968
  }
969
+ if (requestedName.startsWith("next/navigation")) {
970
+ return {
971
+ value: requestedName
972
+ };
973
+ }
964
974
  if (requestedName.startsWith("next")) {
965
975
  return {
966
976
  value: requestedName
@@ -971,7 +981,7 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
971
981
  value: requestedName
972
982
  };
973
983
  }
974
- if (requestedName === "./ValNextProvider") {
984
+ if (requestedName.includes("/ValNextProvider")) {
975
985
  return {
976
986
  value: requestedName
977
987
  };
@@ -1318,7 +1328,7 @@ class ProxyValServer {
1318
1328
  }
1319
1329
  async getFiles(treePath, query, cookies) {
1320
1330
  return this.withAuth(cookies, "getFiles", async data => {
1321
- const url = new URL(`/v1/files/${this.options.valName}/${treePath}`, this.options.valContentUrl);
1331
+ const url = new URL(`/v1/files/${this.options.valName}/~${treePath}`, this.options.valContentUrl);
1322
1332
  if (typeof query.sha256 === "string") {
1323
1333
  url.searchParams.append("sha256", query.sha256);
1324
1334
  } else {
@@ -1570,7 +1580,7 @@ class ProxyValServer {
1570
1580
  source: (source === "true").toString(),
1571
1581
  commit
1572
1582
  });
1573
- const url = new URL(`/v1/tree/${this.options.valName}/heads/${this.options.gitBranch}/${treePath}/?${params}`, this.options.valContentUrl);
1583
+ const url = new URL(`/v1/tree/${this.options.valName}/heads/${this.options.gitBranch}/~${treePath}/?${params}`, this.options.valContentUrl);
1574
1584
  try {
1575
1585
  const fetchRes = await fetch(url, {
1576
1586
  headers: this.getAuthHeaders(data.token, "application/json")
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.35.0",
15
+ "version": "0.37.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.35.0",
28
- "@valbuild/shared": "~0.35.0",
29
- "@valbuild/ui": "~0.35.0",
27
+ "@valbuild/core": "~0.37.0",
28
+ "@valbuild/shared": "~0.37.0",
29
+ "@valbuild/ui": "~0.37.0",
30
30
  "express": "^4.18.2",
31
31
  "image-size": "^1.0.2",
32
32
  "queue": "^6.0.2",