@valbuild/server 0.45.0 → 0.47.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.
@@ -77,13 +77,11 @@ type ValServerOverrides = Partial<{
|
|
77
77
|
*/
|
78
78
|
valContentUrl: string;
|
79
79
|
/**
|
80
|
-
* The
|
81
|
-
*
|
82
|
-
* Typically this is set using the VAL_NAME env var.
|
80
|
+
* The cloud name of this Val project.
|
83
81
|
*
|
84
82
|
* @example "myorg/my-project"
|
85
83
|
*/
|
86
|
-
|
84
|
+
valCloud: string;
|
87
85
|
/**
|
88
86
|
* After Val is enabled, redirect to this url.
|
89
87
|
*
|
@@ -737,7 +737,7 @@ globalThis.valModule = {
|
|
737
737
|
fatalErrors.push(`Could not find a default export in: ${id}. Check if file has a export default val.content(...)`);
|
738
738
|
} else {
|
739
739
|
if (valModule.id !== id) {
|
740
|
-
fatalErrors.push(`Wrong val.content id!
|
740
|
+
fatalErrors.push(`Wrong val.content id! Expected: '${id}', found: '${valModule.id}'`);
|
741
741
|
}
|
742
742
|
if (encodeURIComponent(valModule.id).replace(/%2F/g, "/") !== valModule.id) {
|
743
743
|
fatalErrors.push(`Invalid val.content id! Must be a web-safe path without escape characters, found: '${valModule.id}', which was encoded as: '${encodeURIComponent(valModule.id).replace("%2F", "/")}'`);
|
@@ -1108,6 +1108,8 @@ class Service {
|
|
1108
1108
|
errors: valModule.errors && valModule.errors.validation ? {
|
1109
1109
|
validation: valModule.errors.validation || undefined,
|
1110
1110
|
fatal: valModule.errors.fatal || undefined
|
1111
|
+
} : valModule.errors ? {
|
1112
|
+
fatal: valModule.errors.fatal || undefined
|
1111
1113
|
} : false
|
1112
1114
|
};
|
1113
1115
|
} else {
|
@@ -2017,9 +2019,9 @@ async function initHandlerOptions(route, opts) {
|
|
2017
2019
|
if (!maybeGitBranch) {
|
2018
2020
|
throw new Error("VAL_GIT_BRANCH env var must be set in proxy mode");
|
2019
2021
|
}
|
2020
|
-
const maybeValName = opts.
|
2022
|
+
const maybeValName = opts.valCloud || process.env.VAL_CLOUD_NAME || process.env.VAL_NAME; // VAL_NAME is deprecated
|
2021
2023
|
if (!maybeValName) {
|
2022
|
-
throw new Error("
|
2024
|
+
throw new Error("VAL_CLOUD_NAME env var must be set in proxy mode");
|
2023
2025
|
}
|
2024
2026
|
return {
|
2025
2027
|
mode: "proxy",
|
@@ -2318,7 +2320,9 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2318
2320
|
// width is correct
|
2319
2321
|
"width" in currentValue.metadata && currentValue.metadata.width === imageMetadata.width &&
|
2320
2322
|
// height is correct
|
2321
|
-
"height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height
|
2323
|
+
"height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height &&
|
2324
|
+
// mimeType is correct
|
2325
|
+
"mimeType" in currentValue.metadata && currentValue.metadata.mimeType === imageMetadata.mimeType;
|
2322
2326
|
|
2323
2327
|
// skips if the metadata is already correct
|
2324
2328
|
if (!metadataIsCorrect) {
|
@@ -2353,6 +2357,12 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2353
2357
|
fixes: undefined
|
2354
2358
|
});
|
2355
2359
|
}
|
2360
|
+
if (!("mimeType" in currentValue.metadata) || currentValue.metadata.mimeType !== imageMetadata.mimeType) {
|
2361
|
+
remainingErrors.push({
|
2362
|
+
message: "Image metadata mimeType is incorrect! Found: " + ("mimeType" in currentValue.metadata ? currentValue.metadata.mimeType : "<empty>") + ". Expected: " + imageMetadata.mimeType,
|
2363
|
+
fixes: undefined
|
2364
|
+
});
|
2365
|
+
}
|
2356
2366
|
} else {
|
2357
2367
|
remainingErrors.push({
|
2358
2368
|
...validationError,
|
@@ -2369,7 +2379,8 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2369
2379
|
value: {
|
2370
2380
|
width: imageMetadata.width,
|
2371
2381
|
height: imageMetadata.height,
|
2372
|
-
sha256: imageMetadata.sha256
|
2382
|
+
sha256: imageMetadata.sha256,
|
2383
|
+
mimeType: imageMetadata.mimeType
|
2373
2384
|
}
|
2374
2385
|
});
|
2375
2386
|
}
|
@@ -737,7 +737,7 @@ globalThis.valModule = {
|
|
737
737
|
fatalErrors.push(`Could not find a default export in: ${id}. Check if file has a export default val.content(...)`);
|
738
738
|
} else {
|
739
739
|
if (valModule.id !== id) {
|
740
|
-
fatalErrors.push(`Wrong val.content id!
|
740
|
+
fatalErrors.push(`Wrong val.content id! Expected: '${id}', found: '${valModule.id}'`);
|
741
741
|
}
|
742
742
|
if (encodeURIComponent(valModule.id).replace(/%2F/g, "/") !== valModule.id) {
|
743
743
|
fatalErrors.push(`Invalid val.content id! Must be a web-safe path without escape characters, found: '${valModule.id}', which was encoded as: '${encodeURIComponent(valModule.id).replace("%2F", "/")}'`);
|
@@ -1108,6 +1108,8 @@ class Service {
|
|
1108
1108
|
errors: valModule.errors && valModule.errors.validation ? {
|
1109
1109
|
validation: valModule.errors.validation || undefined,
|
1110
1110
|
fatal: valModule.errors.fatal || undefined
|
1111
|
+
} : valModule.errors ? {
|
1112
|
+
fatal: valModule.errors.fatal || undefined
|
1111
1113
|
} : false
|
1112
1114
|
};
|
1113
1115
|
} else {
|
@@ -2017,9 +2019,9 @@ async function initHandlerOptions(route, opts) {
|
|
2017
2019
|
if (!maybeGitBranch) {
|
2018
2020
|
throw new Error("VAL_GIT_BRANCH env var must be set in proxy mode");
|
2019
2021
|
}
|
2020
|
-
const maybeValName = opts.
|
2022
|
+
const maybeValName = opts.valCloud || process.env.VAL_CLOUD_NAME || process.env.VAL_NAME; // VAL_NAME is deprecated
|
2021
2023
|
if (!maybeValName) {
|
2022
|
-
throw new Error("
|
2024
|
+
throw new Error("VAL_CLOUD_NAME env var must be set in proxy mode");
|
2023
2025
|
}
|
2024
2026
|
return {
|
2025
2027
|
mode: "proxy",
|
@@ -2318,7 +2320,9 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2318
2320
|
// width is correct
|
2319
2321
|
"width" in currentValue.metadata && currentValue.metadata.width === imageMetadata.width &&
|
2320
2322
|
// height is correct
|
2321
|
-
"height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height
|
2323
|
+
"height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height &&
|
2324
|
+
// mimeType is correct
|
2325
|
+
"mimeType" in currentValue.metadata && currentValue.metadata.mimeType === imageMetadata.mimeType;
|
2322
2326
|
|
2323
2327
|
// skips if the metadata is already correct
|
2324
2328
|
if (!metadataIsCorrect) {
|
@@ -2353,6 +2357,12 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2353
2357
|
fixes: undefined
|
2354
2358
|
});
|
2355
2359
|
}
|
2360
|
+
if (!("mimeType" in currentValue.metadata) || currentValue.metadata.mimeType !== imageMetadata.mimeType) {
|
2361
|
+
remainingErrors.push({
|
2362
|
+
message: "Image metadata mimeType is incorrect! Found: " + ("mimeType" in currentValue.metadata ? currentValue.metadata.mimeType : "<empty>") + ". Expected: " + imageMetadata.mimeType,
|
2363
|
+
fixes: undefined
|
2364
|
+
});
|
2365
|
+
}
|
2356
2366
|
} else {
|
2357
2367
|
remainingErrors.push({
|
2358
2368
|
...validationError,
|
@@ -2369,7 +2379,8 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2369
2379
|
value: {
|
2370
2380
|
width: imageMetadata.width,
|
2371
2381
|
height: imageMetadata.height,
|
2372
|
-
sha256: imageMetadata.sha256
|
2382
|
+
sha256: imageMetadata.sha256,
|
2383
|
+
mimeType: imageMetadata.mimeType
|
2373
2384
|
}
|
2374
2385
|
});
|
2375
2386
|
}
|
@@ -707,7 +707,7 @@ globalThis.valModule = {
|
|
707
707
|
fatalErrors.push(`Could not find a default export in: ${id}. Check if file has a export default val.content(...)`);
|
708
708
|
} else {
|
709
709
|
if (valModule.id !== id) {
|
710
|
-
fatalErrors.push(`Wrong val.content id!
|
710
|
+
fatalErrors.push(`Wrong val.content id! Expected: '${id}', found: '${valModule.id}'`);
|
711
711
|
}
|
712
712
|
if (encodeURIComponent(valModule.id).replace(/%2F/g, "/") !== valModule.id) {
|
713
713
|
fatalErrors.push(`Invalid val.content id! Must be a web-safe path without escape characters, found: '${valModule.id}', which was encoded as: '${encodeURIComponent(valModule.id).replace("%2F", "/")}'`);
|
@@ -1078,6 +1078,8 @@ class Service {
|
|
1078
1078
|
errors: valModule.errors && valModule.errors.validation ? {
|
1079
1079
|
validation: valModule.errors.validation || undefined,
|
1080
1080
|
fatal: valModule.errors.fatal || undefined
|
1081
|
+
} : valModule.errors ? {
|
1082
|
+
fatal: valModule.errors.fatal || undefined
|
1081
1083
|
} : false
|
1082
1084
|
};
|
1083
1085
|
} else {
|
@@ -1987,9 +1989,9 @@ async function initHandlerOptions(route, opts) {
|
|
1987
1989
|
if (!maybeGitBranch) {
|
1988
1990
|
throw new Error("VAL_GIT_BRANCH env var must be set in proxy mode");
|
1989
1991
|
}
|
1990
|
-
const maybeValName = opts.
|
1992
|
+
const maybeValName = opts.valCloud || process.env.VAL_CLOUD_NAME || process.env.VAL_NAME; // VAL_NAME is deprecated
|
1991
1993
|
if (!maybeValName) {
|
1992
|
-
throw new Error("
|
1994
|
+
throw new Error("VAL_CLOUD_NAME env var must be set in proxy mode");
|
1993
1995
|
}
|
1994
1996
|
return {
|
1995
1997
|
mode: "proxy",
|
@@ -2288,7 +2290,9 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2288
2290
|
// width is correct
|
2289
2291
|
"width" in currentValue.metadata && currentValue.metadata.width === imageMetadata.width &&
|
2290
2292
|
// height is correct
|
2291
|
-
"height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height
|
2293
|
+
"height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height &&
|
2294
|
+
// mimeType is correct
|
2295
|
+
"mimeType" in currentValue.metadata && currentValue.metadata.mimeType === imageMetadata.mimeType;
|
2292
2296
|
|
2293
2297
|
// skips if the metadata is already correct
|
2294
2298
|
if (!metadataIsCorrect) {
|
@@ -2323,6 +2327,12 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2323
2327
|
fixes: undefined
|
2324
2328
|
});
|
2325
2329
|
}
|
2330
|
+
if (!("mimeType" in currentValue.metadata) || currentValue.metadata.mimeType !== imageMetadata.mimeType) {
|
2331
|
+
remainingErrors.push({
|
2332
|
+
message: "Image metadata mimeType is incorrect! Found: " + ("mimeType" in currentValue.metadata ? currentValue.metadata.mimeType : "<empty>") + ". Expected: " + imageMetadata.mimeType,
|
2333
|
+
fixes: undefined
|
2334
|
+
});
|
2335
|
+
}
|
2326
2336
|
} else {
|
2327
2337
|
remainingErrors.push({
|
2328
2338
|
...validationError,
|
@@ -2339,7 +2349,8 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
|
|
2339
2349
|
value: {
|
2340
2350
|
width: imageMetadata.width,
|
2341
2351
|
height: imageMetadata.height,
|
2342
|
-
sha256: imageMetadata.sha256
|
2352
|
+
sha256: imageMetadata.sha256,
|
2353
|
+
mimeType: imageMetadata.mimeType
|
2343
2354
|
}
|
2344
2355
|
});
|
2345
2356
|
}
|
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.47.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.47.0",
|
28
|
+
"@valbuild/shared": "~0.47.0",
|
29
|
+
"@valbuild/ui": "~0.47.0",
|
30
30
|
"express": "^4.18.2",
|
31
31
|
"image-size": "^1.0.2",
|
32
32
|
"queue": "^6.0.2",
|