Refactor routing in App component to enhance navigation and improve error handling by integrating dynamic routes and updating the NotFound route.
This commit is contained in:
29
node_modules/astro/dist/env/sync.js
generated
vendored
Normal file
29
node_modules/astro/dist/env/sync.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import fsMod from "node:fs";
|
||||
import { TYPES_TEMPLATE_URL } from "./constants.js";
|
||||
import { getEnvFieldType } from "./validators.js";
|
||||
function syncAstroEnv(settings, fs = fsMod) {
|
||||
if (!settings.config.experimental.env) {
|
||||
return;
|
||||
}
|
||||
const schema = settings.config.experimental.env.schema ?? {};
|
||||
let client = "";
|
||||
let server = "";
|
||||
for (const [key, options] of Object.entries(schema)) {
|
||||
const str = `export const ${key}: ${getEnvFieldType(options)};
|
||||
`;
|
||||
if (options.context === "client") {
|
||||
client += str;
|
||||
} else {
|
||||
server += str;
|
||||
}
|
||||
}
|
||||
const template = fs.readFileSync(TYPES_TEMPLATE_URL, "utf-8");
|
||||
const content = template.replace("// @@CLIENT@@", client).replace("// @@SERVER@@", server);
|
||||
settings.injectedTypes.push({
|
||||
filename: "astro/env.d.ts",
|
||||
content
|
||||
});
|
||||
}
|
||||
export {
|
||||
syncAstroEnv
|
||||
};
|
Reference in New Issue
Block a user