@valbuild/server 0.44.0 → 0.45.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.
@@ -976,7 +976,7 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
976
976
|
}
|
977
977
|
if (modulePath === "@valbuild/react/stega") {
|
978
978
|
return {
|
979
|
-
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 */ };
|
979
|
+
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 */ }; export const stegaClean = () => { throw Error(`Cannot use 'stegaClean' in this type of file`) }; export const stegaDecodeString = () => { throw Error(`Cannot use 'stegaDecodeString' in this type of file`) }; "
|
980
980
|
};
|
981
981
|
}
|
982
982
|
if (modulePath.startsWith("next/navigation")) {
|
@@ -1004,6 +1004,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1004
1004
|
value: "export const ValNextProvider = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValNextProvider' in this file`) } } } )"
|
1005
1005
|
};
|
1006
1006
|
}
|
1007
|
+
if (modulePath.includes("/ValImage")) {
|
1008
|
+
return {
|
1009
|
+
value: "export const ValImage = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValImage' in this file`) } } } )"
|
1010
|
+
};
|
1011
|
+
}
|
1007
1012
|
return {
|
1008
1013
|
value: moduleLoader.getModule(modulePath)
|
1009
1014
|
};
|
@@ -1054,6 +1059,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1054
1059
|
value: requestedName
|
1055
1060
|
};
|
1056
1061
|
}
|
1062
|
+
if (requestedName.includes("/ValImage")) {
|
1063
|
+
return {
|
1064
|
+
value: requestedName
|
1065
|
+
};
|
1066
|
+
}
|
1057
1067
|
const modulePath = moduleLoader.resolveModulePath(baseModuleName, requestedName);
|
1058
1068
|
return {
|
1059
1069
|
value: modulePath
|
@@ -1262,7 +1272,7 @@ class LocalValServer {
|
|
1262
1272
|
return {
|
1263
1273
|
cookies: {
|
1264
1274
|
[internal.VAL_ENABLE_COOKIE_NAME]: {
|
1265
|
-
value:
|
1275
|
+
value: "false"
|
1266
1276
|
}
|
1267
1277
|
},
|
1268
1278
|
status: 302,
|
@@ -2266,12 +2276,25 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2266
2276
|
const filename = path__namespace["default"].join(config.projectRoot, maybeRef);
|
2267
2277
|
const buffer = fs__default["default"].readFileSync(filename);
|
2268
2278
|
const imageSize = sizeOf__default["default"](buffer);
|
2279
|
+
const mimeType = imageSize.type ? internal.imageTypeToMimeType(imageSize.type) : internal.filenameToMimeType(filename);
|
2280
|
+
if (!mimeType) {
|
2281
|
+
throw Error("Cannot determine mimetype of image");
|
2282
|
+
}
|
2283
|
+
const {
|
2284
|
+
width,
|
2285
|
+
height
|
2286
|
+
} = imageSize;
|
2287
|
+
if (!width || !height) {
|
2288
|
+
throw Error("Cannot determine image size");
|
2289
|
+
}
|
2269
2290
|
const sha256 = core.Internal.getSHA256Hash(textEncoder.encode(
|
2270
2291
|
// TODO: we should probably store the mimetype in the metadata and reuse it here
|
2271
|
-
`data:${
|
2292
|
+
`data:${mimeType};base64,${buffer.toString("base64")}`));
|
2272
2293
|
return {
|
2273
|
-
|
2274
|
-
|
2294
|
+
width,
|
2295
|
+
height,
|
2296
|
+
sha256,
|
2297
|
+
mimeType
|
2275
2298
|
};
|
2276
2299
|
}
|
2277
2300
|
const remainingErrors = [];
|
@@ -2306,7 +2329,8 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2306
2329
|
value: {
|
2307
2330
|
width: imageMetadata.width,
|
2308
2331
|
height: imageMetadata.height,
|
2309
|
-
sha256: imageMetadata.sha256
|
2332
|
+
sha256: imageMetadata.sha256,
|
2333
|
+
mimeType: imageMetadata.mimeType
|
2310
2334
|
}
|
2311
2335
|
});
|
2312
2336
|
} else {
|
@@ -976,7 +976,7 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
976
976
|
}
|
977
977
|
if (modulePath === "@valbuild/react/stega") {
|
978
978
|
return {
|
979
|
-
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 */ };
|
979
|
+
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 */ }; export const stegaClean = () => { throw Error(`Cannot use 'stegaClean' in this type of file`) }; export const stegaDecodeString = () => { throw Error(`Cannot use 'stegaDecodeString' in this type of file`) }; "
|
980
980
|
};
|
981
981
|
}
|
982
982
|
if (modulePath.startsWith("next/navigation")) {
|
@@ -1004,6 +1004,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1004
1004
|
value: "export const ValNextProvider = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValNextProvider' in this file`) } } } )"
|
1005
1005
|
};
|
1006
1006
|
}
|
1007
|
+
if (modulePath.includes("/ValImage")) {
|
1008
|
+
return {
|
1009
|
+
value: "export const ValImage = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValImage' in this file`) } } } )"
|
1010
|
+
};
|
1011
|
+
}
|
1007
1012
|
return {
|
1008
1013
|
value: moduleLoader.getModule(modulePath)
|
1009
1014
|
};
|
@@ -1054,6 +1059,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1054
1059
|
value: requestedName
|
1055
1060
|
};
|
1056
1061
|
}
|
1062
|
+
if (requestedName.includes("/ValImage")) {
|
1063
|
+
return {
|
1064
|
+
value: requestedName
|
1065
|
+
};
|
1066
|
+
}
|
1057
1067
|
const modulePath = moduleLoader.resolveModulePath(baseModuleName, requestedName);
|
1058
1068
|
return {
|
1059
1069
|
value: modulePath
|
@@ -1262,7 +1272,7 @@ class LocalValServer {
|
|
1262
1272
|
return {
|
1263
1273
|
cookies: {
|
1264
1274
|
[internal.VAL_ENABLE_COOKIE_NAME]: {
|
1265
|
-
value:
|
1275
|
+
value: "false"
|
1266
1276
|
}
|
1267
1277
|
},
|
1268
1278
|
status: 302,
|
@@ -2266,12 +2276,25 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2266
2276
|
const filename = path__namespace["default"].join(config.projectRoot, maybeRef);
|
2267
2277
|
const buffer = fs__default["default"].readFileSync(filename);
|
2268
2278
|
const imageSize = sizeOf__default["default"](buffer);
|
2279
|
+
const mimeType = imageSize.type ? internal.imageTypeToMimeType(imageSize.type) : internal.filenameToMimeType(filename);
|
2280
|
+
if (!mimeType) {
|
2281
|
+
throw Error("Cannot determine mimetype of image");
|
2282
|
+
}
|
2283
|
+
const {
|
2284
|
+
width,
|
2285
|
+
height
|
2286
|
+
} = imageSize;
|
2287
|
+
if (!width || !height) {
|
2288
|
+
throw Error("Cannot determine image size");
|
2289
|
+
}
|
2269
2290
|
const sha256 = core.Internal.getSHA256Hash(textEncoder.encode(
|
2270
2291
|
// TODO: we should probably store the mimetype in the metadata and reuse it here
|
2271
|
-
`data:${
|
2292
|
+
`data:${mimeType};base64,${buffer.toString("base64")}`));
|
2272
2293
|
return {
|
2273
|
-
|
2274
|
-
|
2294
|
+
width,
|
2295
|
+
height,
|
2296
|
+
sha256,
|
2297
|
+
mimeType
|
2275
2298
|
};
|
2276
2299
|
}
|
2277
2300
|
const remainingErrors = [];
|
@@ -2306,7 +2329,8 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2306
2329
|
value: {
|
2307
2330
|
width: imageMetadata.width,
|
2308
2331
|
height: imageMetadata.height,
|
2309
|
-
sha256: imageMetadata.sha256
|
2332
|
+
sha256: imageMetadata.sha256,
|
2333
|
+
mimeType: imageMetadata.mimeType
|
2310
2334
|
}
|
2311
2335
|
});
|
2312
2336
|
} else {
|
@@ -946,7 +946,7 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
946
946
|
}
|
947
947
|
if (modulePath === "@valbuild/react/stega") {
|
948
948
|
return {
|
949
|
-
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 */ };
|
949
|
+
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 */ }; export const stegaClean = () => { throw Error(`Cannot use 'stegaClean' in this type of file`) }; export const stegaDecodeString = () => { throw Error(`Cannot use 'stegaDecodeString' in this type of file`) }; "
|
950
950
|
};
|
951
951
|
}
|
952
952
|
if (modulePath.startsWith("next/navigation")) {
|
@@ -974,6 +974,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
974
974
|
value: "export const ValNextProvider = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValNextProvider' in this file`) } } } )"
|
975
975
|
};
|
976
976
|
}
|
977
|
+
if (modulePath.includes("/ValImage")) {
|
978
|
+
return {
|
979
|
+
value: "export const ValImage = new Proxy({}, { get() { return () => { throw new Error(`Cannot import 'ValImage' in this file`) } } } )"
|
980
|
+
};
|
981
|
+
}
|
977
982
|
return {
|
978
983
|
value: moduleLoader.getModule(modulePath)
|
979
984
|
};
|
@@ -1024,6 +1029,11 @@ async function newValQuickJSRuntime(quickJSModule, moduleLoader, {
|
|
1024
1029
|
value: requestedName
|
1025
1030
|
};
|
1026
1031
|
}
|
1032
|
+
if (requestedName.includes("/ValImage")) {
|
1033
|
+
return {
|
1034
|
+
value: requestedName
|
1035
|
+
};
|
1036
|
+
}
|
1027
1037
|
const modulePath = moduleLoader.resolveModulePath(baseModuleName, requestedName);
|
1028
1038
|
return {
|
1029
1039
|
value: modulePath
|
@@ -1232,7 +1242,7 @@ class LocalValServer {
|
|
1232
1242
|
return {
|
1233
1243
|
cookies: {
|
1234
1244
|
[VAL_ENABLE_COOKIE_NAME]: {
|
1235
|
-
value:
|
1245
|
+
value: "false"
|
1236
1246
|
}
|
1237
1247
|
},
|
1238
1248
|
status: 302,
|
@@ -2236,12 +2246,25 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2236
2246
|
const filename = path__default.join(config.projectRoot, maybeRef);
|
2237
2247
|
const buffer = fs.readFileSync(filename);
|
2238
2248
|
const imageSize = sizeOf(buffer);
|
2249
|
+
const mimeType = imageSize.type ? imageTypeToMimeType(imageSize.type) : filenameToMimeType(filename);
|
2250
|
+
if (!mimeType) {
|
2251
|
+
throw Error("Cannot determine mimetype of image");
|
2252
|
+
}
|
2253
|
+
const {
|
2254
|
+
width,
|
2255
|
+
height
|
2256
|
+
} = imageSize;
|
2257
|
+
if (!width || !height) {
|
2258
|
+
throw Error("Cannot determine image size");
|
2259
|
+
}
|
2239
2260
|
const sha256 = Internal.getSHA256Hash(textEncoder.encode(
|
2240
2261
|
// TODO: we should probably store the mimetype in the metadata and reuse it here
|
2241
|
-
`data:${
|
2262
|
+
`data:${mimeType};base64,${buffer.toString("base64")}`));
|
2242
2263
|
return {
|
2243
|
-
|
2244
|
-
|
2264
|
+
width,
|
2265
|
+
height,
|
2266
|
+
sha256,
|
2267
|
+
mimeType
|
2245
2268
|
};
|
2246
2269
|
}
|
2247
2270
|
const remainingErrors = [];
|
@@ -2276,7 +2299,8 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2276
2299
|
value: {
|
2277
2300
|
width: imageMetadata.width,
|
2278
2301
|
height: imageMetadata.height,
|
2279
|
-
sha256: imageMetadata.sha256
|
2302
|
+
sha256: imageMetadata.sha256,
|
2303
|
+
mimeType: imageMetadata.mimeType
|
2280
2304
|
}
|
2281
2305
|
});
|
2282
2306
|
} else {
|
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.45.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.45.0",
|
28
|
+
"@valbuild/shared": "~0.45.0",
|
29
|
+
"@valbuild/ui": "~0.45.0",
|
30
30
|
"express": "^4.18.2",
|
31
31
|
"image-size": "^1.0.2",
|
32
32
|
"queue": "^6.0.2",
|