-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'content-layer' into content-layer-rendering
- Loading branch information
Showing
8 changed files
with
63 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fixes a case where invalid `astro:env` variables at runtime would not throw correctly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// IMPORTANT: do not publish this file! It's only intended for development within the monorepo | ||
|
||
declare module 'virtual:astro:env/internal' { | ||
export const schema: import('./src/env/schema.js').EnvSchema; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { ValidationResultErrors } from './validators.js'; | ||
|
||
export interface InvalidVariable { | ||
key: string; | ||
type: string; | ||
errors: ValidationResultErrors; | ||
} | ||
|
||
export function invalidVariablesToError(invalid: Array<InvalidVariable>) { | ||
const _errors: Array<string> = []; | ||
for (const { key, type, errors } of invalid) { | ||
if (errors[0] === 'missing') { | ||
_errors.push(`${key} is missing`); | ||
} else if (errors[0] === 'type') { | ||
_errors.push(`${key}'s type is invalid, expected: ${type}`); | ||
} else { | ||
// constraints | ||
_errors.push(`The following constraints for ${key} are not met: ${errors.join(', ')}`); | ||
} | ||
} | ||
return _errors; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters