@valbuild/server 0.46.0 → 0.47.1

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.
@@ -733,11 +733,9 @@ globalThis.valModule = {
733
733
  const valModule = context.getProp(context.global, "valModule").consume(context.dump);
734
734
  if (!valModule) {
735
735
  fatalErrors.push(`Could not find any modules at: ${id}`);
736
- } else if (valModule.defaultExport === false) {
737
- fatalErrors.push(`Could not find a default export in: ${id}. Check if file has a export default val.content(...)`);
738
- } else {
736
+ } else if (valModule.defaultExport) {
739
737
  if (valModule.id !== id) {
740
- fatalErrors.push(`Wrong val.content id! In the file of with: '${id}', found: '${valModule.id}'`);
738
+ fatalErrors.push(`Wrong val.content id! Expected: '${id}', found: '${valModule.id}'`);
741
739
  }
742
740
  if (encodeURIComponent(valModule.id).replace(/%2F/g, "/") !== valModule.id) {
743
741
  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 +1106,8 @@ class Service {
1108
1106
  errors: valModule.errors && valModule.errors.validation ? {
1109
1107
  validation: valModule.errors.validation || undefined,
1110
1108
  fatal: valModule.errors.fatal || undefined
1109
+ } : valModule.errors ? {
1110
+ fatal: valModule.errors.fatal || undefined
1111
1111
  } : false
1112
1112
  };
1113
1113
  } else {
@@ -2318,7 +2318,9 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
2318
2318
  // width is correct
2319
2319
  "width" in currentValue.metadata && currentValue.metadata.width === imageMetadata.width &&
2320
2320
  // height is correct
2321
- "height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height;
2321
+ "height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height &&
2322
+ // mimeType is correct
2323
+ "mimeType" in currentValue.metadata && currentValue.metadata.mimeType === imageMetadata.mimeType;
2322
2324
 
2323
2325
  // skips if the metadata is already correct
2324
2326
  if (!metadataIsCorrect) {
@@ -2353,6 +2355,12 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
2353
2355
  fixes: undefined
2354
2356
  });
2355
2357
  }
2358
+ if (!("mimeType" in currentValue.metadata) || currentValue.metadata.mimeType !== imageMetadata.mimeType) {
2359
+ remainingErrors.push({
2360
+ message: "Image metadata mimeType is incorrect! Found: " + ("mimeType" in currentValue.metadata ? currentValue.metadata.mimeType : "<empty>") + ". Expected: " + imageMetadata.mimeType,
2361
+ fixes: undefined
2362
+ });
2363
+ }
2356
2364
  } else {
2357
2365
  remainingErrors.push({
2358
2366
  ...validationError,
@@ -2369,7 +2377,8 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
2369
2377
  value: {
2370
2378
  width: imageMetadata.width,
2371
2379
  height: imageMetadata.height,
2372
- sha256: imageMetadata.sha256
2380
+ sha256: imageMetadata.sha256,
2381
+ mimeType: imageMetadata.mimeType
2373
2382
  }
2374
2383
  });
2375
2384
  }
@@ -733,11 +733,9 @@ globalThis.valModule = {
733
733
  const valModule = context.getProp(context.global, "valModule").consume(context.dump);
734
734
  if (!valModule) {
735
735
  fatalErrors.push(`Could not find any modules at: ${id}`);
736
- } else if (valModule.defaultExport === false) {
737
- fatalErrors.push(`Could not find a default export in: ${id}. Check if file has a export default val.content(...)`);
738
- } else {
736
+ } else if (valModule.defaultExport) {
739
737
  if (valModule.id !== id) {
740
- fatalErrors.push(`Wrong val.content id! In the file of with: '${id}', found: '${valModule.id}'`);
738
+ fatalErrors.push(`Wrong val.content id! Expected: '${id}', found: '${valModule.id}'`);
741
739
  }
742
740
  if (encodeURIComponent(valModule.id).replace(/%2F/g, "/") !== valModule.id) {
743
741
  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 +1106,8 @@ class Service {
1108
1106
  errors: valModule.errors && valModule.errors.validation ? {
1109
1107
  validation: valModule.errors.validation || undefined,
1110
1108
  fatal: valModule.errors.fatal || undefined
1109
+ } : valModule.errors ? {
1110
+ fatal: valModule.errors.fatal || undefined
1111
1111
  } : false
1112
1112
  };
1113
1113
  } else {
@@ -2318,7 +2318,9 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
2318
2318
  // width is correct
2319
2319
  "width" in currentValue.metadata && currentValue.metadata.width === imageMetadata.width &&
2320
2320
  // height is correct
2321
- "height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height;
2321
+ "height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height &&
2322
+ // mimeType is correct
2323
+ "mimeType" in currentValue.metadata && currentValue.metadata.mimeType === imageMetadata.mimeType;
2322
2324
 
2323
2325
  // skips if the metadata is already correct
2324
2326
  if (!metadataIsCorrect) {
@@ -2353,6 +2355,12 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
2353
2355
  fixes: undefined
2354
2356
  });
2355
2357
  }
2358
+ if (!("mimeType" in currentValue.metadata) || currentValue.metadata.mimeType !== imageMetadata.mimeType) {
2359
+ remainingErrors.push({
2360
+ message: "Image metadata mimeType is incorrect! Found: " + ("mimeType" in currentValue.metadata ? currentValue.metadata.mimeType : "<empty>") + ". Expected: " + imageMetadata.mimeType,
2361
+ fixes: undefined
2362
+ });
2363
+ }
2356
2364
  } else {
2357
2365
  remainingErrors.push({
2358
2366
  ...validationError,
@@ -2369,7 +2377,8 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
2369
2377
  value: {
2370
2378
  width: imageMetadata.width,
2371
2379
  height: imageMetadata.height,
2372
- sha256: imageMetadata.sha256
2380
+ sha256: imageMetadata.sha256,
2381
+ mimeType: imageMetadata.mimeType
2373
2382
  }
2374
2383
  });
2375
2384
  }
@@ -703,11 +703,9 @@ globalThis.valModule = {
703
703
  const valModule = context.getProp(context.global, "valModule").consume(context.dump);
704
704
  if (!valModule) {
705
705
  fatalErrors.push(`Could not find any modules at: ${id}`);
706
- } else if (valModule.defaultExport === false) {
707
- fatalErrors.push(`Could not find a default export in: ${id}. Check if file has a export default val.content(...)`);
708
- } else {
706
+ } else if (valModule.defaultExport) {
709
707
  if (valModule.id !== id) {
710
- fatalErrors.push(`Wrong val.content id! In the file of with: '${id}', found: '${valModule.id}'`);
708
+ fatalErrors.push(`Wrong val.content id! Expected: '${id}', found: '${valModule.id}'`);
711
709
  }
712
710
  if (encodeURIComponent(valModule.id).replace(/%2F/g, "/") !== valModule.id) {
713
711
  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 +1076,8 @@ class Service {
1078
1076
  errors: valModule.errors && valModule.errors.validation ? {
1079
1077
  validation: valModule.errors.validation || undefined,
1080
1078
  fatal: valModule.errors.fatal || undefined
1079
+ } : valModule.errors ? {
1080
+ fatal: valModule.errors.fatal || undefined
1081
1081
  } : false
1082
1082
  };
1083
1083
  } else {
@@ -2288,7 +2288,9 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
2288
2288
  // width is correct
2289
2289
  "width" in currentValue.metadata && currentValue.metadata.width === imageMetadata.width &&
2290
2290
  // height is correct
2291
- "height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height;
2291
+ "height" in currentValue.metadata && currentValue.metadata.height === imageMetadata.height &&
2292
+ // mimeType is correct
2293
+ "mimeType" in currentValue.metadata && currentValue.metadata.mimeType === imageMetadata.mimeType;
2292
2294
 
2293
2295
  // skips if the metadata is already correct
2294
2296
  if (!metadataIsCorrect) {
@@ -2323,6 +2325,12 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
2323
2325
  fixes: undefined
2324
2326
  });
2325
2327
  }
2328
+ if (!("mimeType" in currentValue.metadata) || currentValue.metadata.mimeType !== imageMetadata.mimeType) {
2329
+ remainingErrors.push({
2330
+ message: "Image metadata mimeType is incorrect! Found: " + ("mimeType" in currentValue.metadata ? currentValue.metadata.mimeType : "<empty>") + ". Expected: " + imageMetadata.mimeType,
2331
+ fixes: undefined
2332
+ });
2333
+ }
2326
2334
  } else {
2327
2335
  remainingErrors.push({
2328
2336
  ...validationError,
@@ -2339,7 +2347,8 @@ async function createFixPatch(config, apply, sourcePath, validationError) {
2339
2347
  value: {
2340
2348
  width: imageMetadata.width,
2341
2349
  height: imageMetadata.height,
2342
- sha256: imageMetadata.sha256
2350
+ sha256: imageMetadata.sha256,
2351
+ mimeType: imageMetadata.mimeType
2343
2352
  }
2344
2353
  });
2345
2354
  }
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.46.0",
15
+ "version": "0.47.1",
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.46.0",
28
- "@valbuild/shared": "~0.46.0",
29
- "@valbuild/ui": "~0.46.0",
27
+ "@valbuild/core": "~0.47.0",
28
+ "@valbuild/shared": "~0.47.0",
29
+ "@valbuild/ui": "~0.47.1",
30
30
  "express": "^4.18.2",
31
31
  "image-size": "^1.0.2",
32
32
  "queue": "^6.0.2",